I know this topic already exists but i strongly disagree with the explanation there. Let met make something clear:
When you have a string argument in a workflow with a default value of “test” (in the workflow) and you don’t specify a value for that argument when calling that workflow the variable gets a value of “test”, that looks perfectly normal to me. When you have a boolean argument with no value specified when calling the variable is always False regardless of the default in the workflow, which is simply wrong. The argument in the other thread that this is because the default value of a boolean is False make no sense since a default value of string is null (nothing). So why is my string argument not null when i don’t specify a value? Because it has a default value! So why is my boolean argument not set to his default??? so both types are clearly behaving different from the default .Net default interpretation of the type.
If the boolean behaviour is correct, how can i pass a null value for my string now? It is set to the default of the workflow when i don’t specify it… Makes no sense right?
I think i might know where this issue starts. If you have a param type of string and don’t set a value when calling the workflow you get a null in code. There probably is a check like: if (paramvalue is null) then use default. A default(boolean) results in False, which is where the problem starts. A nullable boolean should have been used for the parameter settings type. Then if there was no value specified with when calling the workflow you could check the nullable boolean for hasvalue and if not, use the default. This could be a limit of the technology used but either way, it is still wrong behaviour. It is weird that you have to remove the empty boolean argument from a workflow call to get the default value. if you leave the empty line you always get false. This could be fixed by making the value fields for non nullable arguments required, so you know you are setting a value and not using the default. Maybe with a tooltip mentioning the default value when removing the argument line?
Can you upload a quick example showing what you’re talking about?
Strings are reference type. They can be null. If not initialized, a string will default to null. Booleans are a value type, so they cannot be null. If not initialized, a boolean will default to false.