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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Using dynamic content ...
Power Automate
Answered

Using dynamic content in expression in Flow If statement

(0) ShareShare
ReportReport
Posted on by 26

I am trying to build an expression in the "To" field of the Send an Email action. I have a dynamic field that will either be blank, say "Pending Coverage" or include an email address. There are not other options for this field.

 

I need an expression that leaves the to field as blank if the field is blank or states "Pending Coverage" but includes the email address if it's an email address.

 

I have tried to write out the expression but am having trouble determining how to call the dynamic fields. Here is what I have currently:

if([Covering Provider 1 for Polk Dalton Clinic]=Pending Coverage, ' ', '[Covering Provider 1 for Polk Dalton Clinic]')

where Covering Provider 1 for Polk Dalton Clinic is the name of my dynamic field.

Categories:
I have the same question (0)
  • yashag2255 Profile Picture
    24,769 Super User 2024 Season 1 on at

    Hi @kels89 

     

    Please refer to the flow below:

    hha.png

     

    Expression if:

    if(equals(variables('Covering Provider 1 for Polk Dalton Clinic'),variables('pendingCoverage')),'',variables('Covering Provider 1 for Polk Dalton Clinic'))

    I Initialised a variable and put the value as "Pending Coverage" and instead of the field i initialised a variable for that too. But you can keep the field as is in your flow. I am using the equals function to check if they are equal and if that is true, then it leaves a balnk value and if not it keeps the field value. 

     

    Hope this Helps!

     

    If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

  • MarkStokes Profile Picture
    561 on at
    What is your Dynamic field? A compose action? A variable? A PowerApps input? Depending on where the dynamic field is created the format to access it in the expression will be different.

    A simple way to be sure will be to load it into a Variable as the other reply suggests. Then you can access it in the expression with

    variables(‘variable name’)

    Remember to change ‘variable name’ to the actual name of your variable.

    You can also put the cursor in your expression where you want your dynamic field, click the Dynamic Fields tab of the box, find your field, click it and it puts the value into your expression at the right place.

    - Mark
  • Verified answer
    v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi @kels89 ,

     

    According to your description, you want to return a null value if the field is blank or contains a value “Pending Coverage”, while if it contains an email address, return the email address.

     

    The function could be configured likes below. You may need to combine if function with equals, empty, or, etc. to achieve your goal:

    if(or(empty(triggerBody()?['Provider']),equals(triggerBody()?['Provider'],'Pending')),'',triggerBody()?['Provider'])

     

    However, I am afraid that your scenario should be modified, because To field is mandatory, you have to enter a value into it when using action Send an email, otherwise, the flow will be failed.

     

    More details about WDL function reference at here:

    https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference

     

    Best regards,

    Mabel

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 594

#2
Valantis Profile Picture

Valantis 328

#3
David_MA Profile Picture

David_MA 281 Super User 2026 Season 1

Last 30 days Overall leaderboard