cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
livingstonep
Kudo Commander
Kudo Commander

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
v-yamao-msft
Community Support
Community Support

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
v-yamao-msft
Community Support
Community Support

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

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

 

 

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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,140)