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

create an expression

hello, please your help ...
I need to create a flow that sends an email indicating the final status of a task carried out by different areas and that is registered in a sharepoint list according to the following:

 

task    type              team 1     team 2        team 3 ......   team 8
task1  normal          ok            pending      pending      rejected
task2  emergency   pending   ok                ok                ok

 

so I have tried to initialize a variable according to the following conditions:

for normal type tasks:
- if one of the teams rejects, the task will be rejected
- for the task to be ok, all teams must be ok
- while one of the teams is pending (and the task is not rejected), the task will be pending
for emergency tasks, the task will always be ok ...

 

The logic that I have tried to apply is the following: (as if it were excel)

if (
or (team 1 = "rejected", team 2 = "rejected", ... team 8 = "rejected"), "rejected",
if (and (team 1 = "ok", team 2 = "ok", ... team 8 = "ok"), "ok",
if (type = "emergency"; "ok"; "pending")
))
but I have not managed to translate this logic as an expression of automated

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Hi @jgarciac ,

 

Here is a Power Virtual Agents Community, your questions are related to Power Automate.

I recommend you to create a question inside the Power Automate community because the users can help you better.

https://powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows

 

Your expression is very complex, but when you are using the expressions and and or  you cannot use more than two parameters inside the function.

Basically your expression needs to do similar to my expression.

Ps: the red text you need to fix it.

 

This documentation can help you.

https://docs.microsoft.com/en-us/power-automate/use-expressions-in-conditions

 

if (
or(or(or (equals(team 1, "rejected"), equals(team 2, "rejected"), or (equals(team 3, "rejected"), equals(team 4, "rejected"))  ... team 8 = "rejected")), "rejected",
if (and (team 1 = "ok", team 2 = "ok", ... team 8 = "ok"), "ok",
if (type = "emergency"; "ok"; "pending")
))

 


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

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+1.000 students | 25% OFF) : https://www.udemy.com/pva-beginners

View solution in original post

2 REPLIES 2
Highlighted
Super User
Super User

Hi @jgarciac ,

 

Here is a Power Virtual Agents Community, your questions are related to Power Automate.

I recommend you to create a question inside the Power Automate community because the users can help you better.

https://powerusers.microsoft.com/t5/Building-Flows/bd-p/BuildingFlows

 

Your expression is very complex, but when you are using the expressions and and or  you cannot use more than two parameters inside the function.

Basically your expression needs to do similar to my expression.

Ps: the red text you need to fix it.

 

This documentation can help you.

https://docs.microsoft.com/en-us/power-automate/use-expressions-in-conditions

 

if (
or(or(or (equals(team 1, "rejected"), equals(team 2, "rejected"), or (equals(team 3, "rejected"), equals(team 4, "rejected"))  ... team 8 = "rejected")), "rejected",
if (and (team 1 = "ok", team 2 = "ok", ... team 8 = "ok"), "ok",
if (type = "emergency"; "ok"; "pending")
))

 


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

Renato Romão,

Connect with me here 😉

Power Virtual Agents course (+1.000 students | 25% OFF) : https://www.udemy.com/pva-beginners

View solution in original post

Highlighted

Excellent, thank you very much, after struggling a bit with the parentheses, I left it as indicated, only the "type" evaluated it out so as not to make the expression even more difficult..

 

if(
   or(
        or(
             or(equals(outputs('1'),'REJECTED'),equals(outputs('2'),'REJECTED')),
             or(equals(outputs('3'),'REJECTED'),equals(outputs('4'),'REJECTED'))),
       or(
            or(equals(outputs('5'),'REJECTED'),equals(outputs('6'),'REJECTED')),
            or(equals(outputs('7'),'REJECTED'),equals(outputs('8'),'REJECTED')))),'REJECTED',
  if(
     and(
            and(
                   and(equals(outputs('1'),'OK'),equals(outputs('2'),'OK')),
                   and(equals(outputs('3'),'OK'),equals(outputs('4'),'OK'))),
            and(
                   and(equals(outputs('5'),'OK'),equals(outputs('6'),'OK')),
                   and(equals(outputs('7'),'OK'),equals(outputs('8'),'OK')))),'OK','PENDING'
       )
)

Helpful resources

Announcements
PVA Commnity Blog

NEW Power Virtual Agents Community Blog

View articles posted by fellow community members on the Power Virtual Agents Community Blog!

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
Users online (7,972)