| | | Forum Newbie
       
Group: Forum Members Last Login: Monday, May 26, 2008 Posts: 2, Visits: 9 |
| I'd like to use decision action based on the existence of a Workflow instance variable. If I add a rule like "Variable.MyVariableName Contains Data", I get an error that looks like:
**** Error while executing GetProcessedValue : System.Reflection.TargetInvocationException: System.NullReferenceException:
Looking at the generated code, it uses: _context.Variables["MyVariableName"].Value
which would cause a NullReferenceException if _context.Variables["MyVariableName"] is null. Is there another way to determine if MyVariableName is null?
Thanks |
| | | | Junior Member
       
Group: Forum Members Last Login: Thursday, May 22, 2008 Posts: 6, Visits: 18 |
| | Hi Tonyyng, You can use Expression Editor in Decision action to determine whether the variable (MyVariableName) is null or not. Use the below sample code in Decision action's Expression editor. Find attached the document (DecisionAction.doc) as well as the workflow xml (NullVariable.zip) for your referecce. (Variable.MyVar == null) ? true: false ReturnType+= Sysetm.Boolean Let us know the status after performing this. Regards, Anil
|
| | | | Forum Newbie
       
Group: Forum Members Last Login: Monday, May 26, 2008 Posts: 2, Visits: 9 |
| Thanks. That worked fine.
The expression can be simplified from:
(Variable.MyVariable == null) ? true:false to Variable.MyVariable == null |
| |
|
|