web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Apply to Each Skips Co...
Power Automate
Unanswered

Apply to Each Skips Condition for people field in SharePoint

(0) ShareShare
ReportReport
Posted on by

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:
Capture.PNG

 

Result if the people field is empty:

Capture.PNG

 

Any thoughts?

Categories:
I have the same question (0)
  • Jcook Profile Picture
    7,781 Most Valuable Professional on at

    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*

  • Community Power Platform Member Profile Picture
    on at

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

     

    Capture.PNG

     

     

  • Jcook Profile Picture
    7,781 Most Valuable Professional on at

    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

  • Community Power Platform Member Profile Picture
    on at

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

     

  • Jcook Profile Picture
    7,781 Most Valuable Professional on at

    Hi @Anonymous 

     

    Sorry I missed a parentheses:

     

    substring(variables('Witness'),0,sub(length(variables('Witness')),1))

     

  • Community Power Platform Member Profile Picture
    on at

    Hi @Jcook 

     

    It's always the parentheses 🙂 

    I'm getting this error now

    Capture.PNG

  • Jcook Profile Picture
    7,781 Most Valuable Professional on at

    Hi @Anonymous 

     

    This error is saying the variable is empty. Can you confirm that the variable has something in it for that run

  • Community Power Platform Member Profile Picture
    on at

    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?Capture.PNG

  • Verified answer
    Jcook Profile Picture
    7,781 Most Valuable Professional on at

    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.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 523 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 406 Moderator

#3
abm abm Profile Picture

abm abm 245 Most Valuable Professional

Last 30 days Overall leaderboard