cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
kels89
Level: Powered On

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

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
Dual Super User
Dual Super User

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!

Super User
Super User

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

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
thirdimage

Power Automate Community User Group Member Badge

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

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,682)