Without the detailed error information you see, it's hard to be sure, but I'm sure your card is not working, because all parameters in the BizTalk XSLT processor are passed as lines 1 .
When I try to run something like the function that you provided as embedded C #, I get the following error:
An object of type "System.String" cannot be converted to a type of "System.DateTime"
Replace your inline C # with something like the following:
public string ConvertDateTime(string param1) { DateTime inputDate = DateTime.Parse(param1); return inputDate.ToString("yyyyMMdd"); }
Note that the parameter type is now a string, and you can then convert it to DateTime and execute your string format.
Like other answers, it might be better to include this helper method in an external class - this way you can get your code under the test to deal with edge cases and also use some reuse.
1 The fact that all parameters in BizTalk XSLT are strings can be the source of many errors - another common with mathematical calculations. If you return the numerical values from your functoids scripting functions, BizTalk will help you convert them to strings to match them with the outgoing schema, but it won’t perform very random rounding of the resulting result values so efficiently. Converting returned values to strings in C # will eliminate this risk and give the expected results.
source share