cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Using dynamic content in expression in Flow If statement

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.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Using dynamic content in expression in Flow If statement

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

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Highlighted
Dual Super User III
Dual Super User III

Re: Using dynamic content in expression in Flow If statement

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!

Highlighted
Skilled Sharer
Skilled Sharer

Re: Using dynamic content in expression in Flow If statement

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
Highlighted
Community Support
Community Support

Re: Using dynamic content in expression in Flow If statement

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

 

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (6,535)