cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
livingstonep
Level 8

Flow fails when using coalesce to test field inside IF condition

Hi,

 

I am trying to get this test condition to work in y "Send HTML Email" Step:

 

if(equals(triggerBody()['Advertising']['Value'],'Local Digital Ads'),
	if(equals(coalesce(triggerBody()['Digital_Budget']['Value'],'NULL'),'NULL'), '',
		if(equals(triggerBody()['Digital_Budget']['Value'],'Other...'), 
			'tr.DigitalBudget {display: none} tr.DigitalBudgetOther {display: visible}', 
			'tr.DigitalBudget {display: visible} tr.DigitalBudgetOther {display: none}'	
			)),'')

 

so basically

  1. if Advertising = "Local Digital Ads"
  2. check the value of Digital_Budget is not NULL
  3. then check that the value of Digital Budget = "Other..." before outputting some CSS rules into the body of the HTML email

Unfortnately I am still getting an error:

 property 'Digital_Budget' doesn't exist

So what's the right way to do this?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Flow fails when using coalesce to test field inside IF condition

Hi @livingstonep ,

 

What are the column types of Advertising and Digital Budget? Are they of type choice?

What’s the exact column name of Digital_Budget in Flow?

To know the exact name in Flow, please add a compose action then select dynamic content as Inputs, hover on it to get the exact name.

1.PNG

I have made the following test for your scenario.

Before starting the flow, I added two Choice columns in the list named as Review Status and DigitalBudget.

Then in the flow, add a Compose action with the following code:

 

if(equals(triggerBody()?['Review_x0020_Status']?['Value'],'aa'),

if(equals(triggerBody()?['DigitalBudget']?['Value'],'Null'),'Null',

if(equals(triggerBody()?['DigitalBudget']?['Value'],'other'),'tr.DigitalBudget {display: none} tr.DigitalBudgetOther {display: visible}','tr.DigitalBudget {display: visible} tr.DigitalBudgetOther {display: none}')),'')

 

In the action Send an email, select compose output for the body field and enable Yes for is HTML field.

Image for your reference.

2.PNG3.PNG

 

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

Re: Flow fails when using coalesce to test field inside IF condition

Hi @livingstonep ,

 

What are the column types of Advertising and Digital Budget? Are they of type choice?

What’s the exact column name of Digital_Budget in Flow?

To know the exact name in Flow, please add a compose action then select dynamic content as Inputs, hover on it to get the exact name.

1.PNG

I have made the following test for your scenario.

Before starting the flow, I added two Choice columns in the list named as Review Status and DigitalBudget.

Then in the flow, add a Compose action with the following code:

 

if(equals(triggerBody()?['Review_x0020_Status']?['Value'],'aa'),

if(equals(triggerBody()?['DigitalBudget']?['Value'],'Null'),'Null',

if(equals(triggerBody()?['DigitalBudget']?['Value'],'other'),'tr.DigitalBudget {display: none} tr.DigitalBudgetOther {display: visible}','tr.DigitalBudget {display: visible} tr.DigitalBudgetOther {display: none}')),'')

 

In the action Send an email, select compose output for the body field and enable Yes for is HTML field.

Image for your reference.

2.PNG3.PNG

 

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

livingstonep
Level 8

Re: Flow fails when using coalesce to test field inside IF condition

hi,

thanks for your response

 

Advertising and Digital Budget are both Choice fields, with no default value.

 

Digital_Budget is only available, required, and populated by the user when Advertising is set to Local Digital Ads.

so checking for coalesce NULL should work shouldn't it?

here below you can see the the problematic field is called Digital_Budget

Digital_Budget.JPG

 

 

livingstonep
Level 8

Re: Flow fails when using coalesce to test field inside IF condition

Hi, I get this error when Advertising <> 'Local Digital Ads', as in this case Digital_Budget is not populated:
InvalidTemplate. Unable to process template language expressions in action 'ComposeDigitalBudgetStyle' inputs at line '1' and column '2534': 'The template language expression 'if(equals(triggerBody()['Advertising']['Value'],'Local Digital Ads'), if(equals(coalesce(triggerBody()['Digital_Budget'],'NULL'),'NULL'), '', if(equals(triggerBody()?['DigitalBudget']?['Value'],'other') , 'tr.DigitalBudget {display: none} tr.DigitalBudgetOther {display: visible}' , 'tr.DigitalBudget {display: visible} tr.DigitalBudgetOther {display: none}')),'')' cannot be evaluated because property 'Digital_Budget' doesn't exist ...
I thought we were only trying to evaluate the condition ''if(equals(coalesce(triggerBody()['Digital_Budget'],'NULL'),'NULL')" when the first condition returns true? So why is it being evaluated?

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
Users Online
Currently online: 256 members 5,088 guests
Please welcome our newest community members: