Hi all,
Having a bit of trouble with my Flow.
I've got a people field ('witness') in SharePoint that if empty, I want it to return "N/A" as text in my email. If the SP field is empty, the apply to each's condition is skipped and I just get a blank. If there are people in the field, I get people just fine (though I haven't figured out to to separate with commas without the last name not having a comma after it).
I've tried append to string (returns a blank), I've tried append to array (returns empty brackets). I still can't figure it out.
Flow:
Result if the people field is empty:
Any thoughts?
Solved! Go to Solution.
Hi @Anonymous
So you don’t want to use the expression directly into the set variable, as this will delete every semi colon or comma at the end of the variable.
I believe you do need the apply to each. But for the inputs in the loop you want to put the dynamic content Value from SharePoint.
That way the loop will loop over Each Value, and Append the AnyEmployee field if not empty from Each Value in SharePoint.
Proud to be a Flownaut!
Hello @Anonymous
In your condition, use empty() expression on the left side with your dynamic content Any Employee inside the ( ).
empty() will return true if the value is empty. So on the right side put true
*NOTE: for the right side use the expression true*
Proud to be a Flownaut!
@Jcook thank you so much, it worked!
I have one last question for you. If I have people in the 'any employee' field, is there a way to separate people with a comma or semi colon, without the last name having a comma or semi colon behind it in the output email? It bugs me visually, but if there's no way to do it, it's not that big of a deal.
Hi @Anonymous
Outside your loop add a Compose action and use this expression:
substring(YourVariable),0,sub(length(YourVariable),1))
replace YourVariable with your dynamic content for your variable
Proud to be a Flownaut!
Hi @Jcook
I'm still having a bit of trouble with this one. Flow keeps telling me the expression isn't valid.
substring(variables('Witness')),0,sub(length(variables('Witness'),1))
Hi @Anonymous
Sorry I missed a parentheses:
substring(variables('Witness'),0,sub(length(variables('Witness')),1))
Proud to be a Flownaut!
Hi @Anonymous
This error is saying the variable is empty. Can you confirm that the variable has something in it for that run
Proud to be a Flownaut!
So if I hardcode in the 'Any employee displayname' dynamic content, into the Witness variable initialization, it creates an apply to each loop, and Flow says that's a no-no. So this is what I have without it hardcoded, and getting the error that the variable is empty. Is this correct?
Hi @Anonymous
So you don’t want to use the expression directly into the set variable, as this will delete every semi colon or comma at the end of the variable.
I believe you do need the apply to each. But for the inputs in the loop you want to put the dynamic content Value from SharePoint.
That way the loop will loop over Each Value, and Append the AnyEmployee field if not empty from Each Value in SharePoint.
Proud to be a Flownaut!
User | Count |
---|---|
87 | |
37 | |
23 | |
20 | |
16 |
User | Count |
---|---|
127 | |
49 | |
46 | |
27 | |
25 |