Thursday, December 7, 2017

SharePoint Designer Workflow suspended when you have a blank lookup field

I've noticed an issue when you're using a SharePoint Designer workflow, and you use the Current Item:LookupField in a task or an email, and that lookup value is blank, and you're setting it to use Lookup Values, Comma Delimited

You'll get an error of something like: 

System.InvalidOperationException: Values must be bound to a non-null expression before ForEach activity 'ForEach<DynamicValue>' can be used.

If you set it as a string, you'll see the JSON that's coming back, and for empty values it returns the string: 


Since Designer can't seem to handle that null object, for any lookup values you can do the following:

1)  Save the value as type String
2)  Test for the empty/null case by testing for the {"results":null} string
3)  Then set the value accordingly

So in my case, I've setup my lookup values as such: 

Where in Step 1 I'm using Current Item:Site Access As String, and inside the if statement I'm using the Current Item:Site Access as Lookup Values, Comma Delimited.


Amy Rockwood said...


harish kalyan said...

Nice blog and valuable for all people. Thank you for posting this.
Informatica MDM Training in Chennai
Informatica mdm training
german classes
Best IELTS Coaching in Chennai
learn Japanese in Chennai
IoT Training in Chennai
content writing course in chennai
Informatica MDM Training in Porur
Informatica MDM Training in Adyar

Ramesh Chilakala said...

it worked like a Charm :) Thanks a ton

merlin said...
This comment has been removed by the author.
merlin said...

It's very useful blog post with inforamtive and insightful content and i had good experience with this information.
Selenium Training in chennai | Selenium Training in anna nagar | Selenium Training in omr | Selenium Training in porur | Selenium Training in tambaram | Selenium Training in velachery

Pathway for German Language said...
This comment has been removed by the author.
Precision Outdoors said...