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: 

{"results":null}

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.

8 comments:

Amy Rockwood said...

THANK YOU THANK YOU THANK YOU!!!! Worked for me.

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...

https://precisionoutdoors12.blogspot.com/2021/01/savvy-advice-on-shipping-gun-parts-and.html
https://precisionoutdoors12.wordpress.com/2021/01/31/savvy-advice-on-shipping-gun-parts-and-firearms-accessories/

Rajput said...

Reloader Activator Free Download
Fine page, in which did u come happening a distant memory the assessment concerning this posting?i have right of access the majority of the articles with respect to your web website now, and I as a matter of fact in addition to your style. much thanks to you a million and absorb save happening the vivacious deed. Reloader Activator Free Download