Question

I'm using the part of a coding in a customer workflow assembly in CRM 2011:

[Input("Organization input")]
[Output("Organization output")]
[ReferenceTarget("organization")]
public InOutArgument<EntityReference> OrgReference { get; set; }
[...]

In the definition of the workflow this input property is not set, that means no value has been selected, it's just empty.

When running the workflow, however, the code inside the if condition gets executed.

if (OrgReference != null)
{ //codeblock gets excuted here }

I would expect that the lines inside the code block is ignored.

Hence, what is the proper way to check if any workflow input properties are set or not?

Thanks, Michael

Était-ce utile?

La solution

You have to call Contact.Get(executionContext) to get the actual value.

if (OrgReference.Get(executionContext) != null)
{ //codeblock gets excuted here }
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top