cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Condition error (EMAIL From,To,CC)

Hello,

 

I have a flow which contains a condition that checks if in (TO: OR CC:) email is contained specific email address.

 

I am getting following error while the flow is being run or during the test.

 

Unable to process template language expressions for action 'Condition' at line '1' and column '2767': 'The template language function 'contains' expects its first argument 'collection' to be a dictionary (object), an array or a string. The provided value is of type 'Null'.'.

image.png

 

This is how the definition of the condition looks like.

image.png

 

An idea just came across my head when I was writing this post and I did one more test.

The 1st email that was received had noone in CC: ... therefore the NULL error... This should be "fixed" as now I would have to make whole new branch of conditions if CC: is not null.... Jeeeeeeeez. I mean of course it is not contained if the variable is not there at all...

 

Guess that on top of this all I will make one variable and assign it the value of CC if it is not null and I will work with that variable instead...

 

Hope this helps someone.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Condition error (EMAIL From,To,CC)

Hi @Kyza 

You should be able to use the Dynamic Content directly without the need for variables.

Please see the below gif which shows how to add the Dynamic Content in to the expression within a condition. In my example I am just using an Input I added to the flow trigger but you should be able to select your From, To, and CC values.

 

2020-01-15_14-31-05.gif

 

 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

View solution in original post

4 REPLIES 4
Highlighted
Super User
Super User

Re: Condition error (EMAIL From,To,CC)

Hi @Kyza 

The Coalesce expression may help you here. Rather than using the Dynamic Content 'as is' in your Condition please try the following.

 

Add an Expression in the left of each of the conditions using the coalesce function coalesce(DynamicContentHere,'blank'replacing the text DynamicContentHere with the Dynamic Content values for From, To, and CC. If you wish you could also change the string blank to something else such as an actual blank string ''.

 

When the condition evaluates, the first non null value will be used in the Coalesce expression. If the From field is NULL then it will check the next value which is the string "blank" (which is never NULL and acts as a default). The condition will check if "blank" contains the email address, which it never will. This should allow you to handle the null values as if they were blank strings and avoid the need for multiple condition actions.

 

Hope that helps.

 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

Highlighted
Helper I
Helper I

Re: Condition error (EMAIL From,To,CC)

Hi @LeeHarris ,

thanks for your input.

 

Would you be so kind and show me how to get the From, To, and CC values into the coalescence expression? I am still getting into it and have not figured out the expressions much yet.

I have initialized variables called "From, To & CC" having data type of string and value from dynamic content.

 

Then I have tried to form the expression like this which is not correct. 

coalesce(variables(To),'blank')
 
I guess I have to use the "triggerBody" inside of the expression or whatsoever?
Highlighted
Super User
Super User

Re: Condition error (EMAIL From,To,CC)

Hi @Kyza 

You should be able to use the Dynamic Content directly without the need for variables.

Please see the below gif which shows how to add the Dynamic Content in to the expression within a condition. In my example I am just using an Input I added to the flow trigger but you should be able to select your From, To, and CC values.

 

2020-01-15_14-31-05.gif

 

 


Did I answer your question? Mark my post as a solution!

Proud to be a Flownaut!


Follow me on Twitter at @QG_LeeJHarris

Or on LinkedIn at in/leejharris

View solution in original post

Highlighted
Helper I
Helper I

Re: Condition error (EMAIL From,To,CC)

Thank you very much, I did not know you can just switch to dynamic content and select what you need while creating an expression... 🙂 

Helpful resources

Announcements
firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

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 (8,758)