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

Flow with IF/THEN statements throwing error

Hello all,

I'm building a flow to automate reminding of colleagues of certain actions when items are added into a sharepoint list. This is what i want to achieve:
Trigger - When list is modified
Level One action - Run condition to check if Account Owner(one of the columns in the list) is person A. If yes, send reminder email to person A. If no, move to Level Two actions
Level Two action 1 - Run condition to check if Account Owner is person B. If yes, send reminder email to person B. If no, send reminder email to person C

There will only be three account owners to this list. And the logic seems sound to me(but please correct me if it is wrong). The issue i am having is the area where i type in the account owners name and the conditional statement to check for that name, as follows:

[Account Owner] {contains} person name.

For the account owner name, i manually key in the account owners first name(which is a part of the [Account Owner] string -- it doesn't auto popluate). I then test this out with a manual trigger in the list, and the flow fails.

Where do you experts see that i am making the errors? I also apologise for potentially having used the wrong nomenclature to describe the fields.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @datasquirrel ,

 

What is the type of the Account Owner column? Is it a person type?

If it is a person type column, you need to choose the Account Owner email dynamic content instead of Account Owner dynamic content in the switch:

1.png

 

And the column shouldn't allow multiple selections as below:

2.png

 

 

Best regards,

Alice   

Community Support Team _ Alice Zhang
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

11 REPLIES 11
Highlighted
Dual Super User III
Dual Super User III

Hi!

Can you share a screenshot from your current flow design?

THanx!



Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Highlighted
Super User II
Super User II

Hello @datasquirrel 

Why don't you try to use a switch control action. Have a look at this example:

flow.png

 You could use a switch on the Account column value (in the sample, it is on the "Modified By Display Name"), and then write the user name in each case (not possible to use contains or other type of formulas in the value field). 

Hope it helps!

Ferran

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Highlighted

Thanks for the quick response. I tried what you recommened, and the error message i get is: The execution of template action 'Switch' failed: The result of the evaluation of 'scope' action expression '@triggerBody()?['AccountOwner']' is not valid. It is of type 'Array' but is expected to be a value of type 'String, Integer'.

Does this mean i have wrongly classifed the "Account Owner" property when i was building out the list?
If it helps, i keyed in the First Name and Last Name of the person verbatim -- which is the same as the Account Owner column

 

Highlighted

Automate Error V1.PNG

Here's an example of using the switch condition( as recommended by another member who responded as well. I've removed the actual names and keyed in First Last for securitty. Other than that, all the relevant tags/calls are in the flow

Hope this helps.

 

Highlighted

Hello @datasquirrel 

Does the AccountOwner column allow multiple values? It seems as it is an array of strings or at least is what the error message says. There's something with this column it gaves some problems.

Did I answer your question? Please consider to mark my post as a solution to help others.
Proud to be a Flownaut!
Highlighted

There are three different Account Owners that i would like to use in that column. This is to reference which of my colleagues is supposed to respond to that line item. Ergo, three different names

 

 

Highlighted

@datasquirrel In your Case you've added First Last which I assume isn't the name of the person it's going to. You need to have the actual name in that field for it to evaluate against. For example if your AccountOwner column is a text column with rob@powerautomate.es as one of the values then in your case it would need to be Equals rob@poweratomate.es. Another example below shows the format of a Case:

1-Switch.png

Rob

Los Gallardos

 

 

Highlighted

Yes, i put in First Last for security since i was showing actual flows. Those were initially the exact names as what are in the Account Owner column. I tried that and i get the string error code that i posted above

 

Highlighted

Hi @datasquirrel ,

 

What is the type of the Account Owner column? Is it a person type?

If it is a person type column, you need to choose the Account Owner email dynamic content instead of Account Owner dynamic content in the switch:

1.png

 

And the column shouldn't allow multiple selections as below:

2.png

 

 

Best regards,

Alice   

Community Support Team _ Alice Zhang
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

Highlighted

Thanks for that suggestion. I tried switching to the email dynamic content as suggested. I get this error message:

Unable to process template language expressions for action 'Switch' at line '1' and column '2810': 'The template language expression 'triggerBody()?['AccountOwner']?['Email']' cannot be evaluated because property 'Email' cannot be selected. Array elements can only be selected using an integer index. Please see https://aka.ms/logicexpressions for usage details.'.

The column in the list is a person type, and doesn't accept multiple selections.

 

Highlighted
Regular Visitor

UPDATE:

I swapped out the Account Owner dynamic content to Account Owner DisplayName. For some reason this works.

Tested it with all my colleagues who will be utilising this list, and the automation for all of them work. Thank you to all for being so patient with me and helping me out!

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (9,775)