Ravindar, Biztalk Developer and Administrator

Just another BizTalk blog

Working with boolean or non-string variables passing to c# method from BizTalk map

The rule here is all the variables inside the BizTalk map are string variables (even if it’s date or boolean or any other).

you would need to explicitly convert them back to there original types before you can use them in the methods.


for example

if you are passing a boolean variable to a method and the c# method signature is like below with the parameter type defined as bool

public static string MyMethod(bool isEligible)


in this case, the c# method will always recieve the isEligible parameter value as true (even if it’s value is sent as false from BizTalk map).


this is because, Biztalk map always operates on string variables, and in this case, when it sends the value “false” to this c# method, and since the method signature defines the variable as type bool, it will just check if the object exists and since the object always exists(as you are passing it), the value of isEligible parameter will always gets set to true.


so, in order to make it behave as we want, we need to define the parameter type as string like below

public static string MyMethod(string isEligible)


and before using it, you need to explicitly convert it to the bool type

bool convertBoolisEligible = System.Convert.ToBoolean(isEligible);



September 14, 2017 - Posted by | Uncategorized

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: