Skip to main content

Notifications

Copilot Studio - General
Answered

create an expression

Posted on by 151

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

Categories:
  • jgarciac Profile Picture
    jgarciac 151 on at
    Re: create an expression

    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'
           )
    )

  • Verified answer
    renatoromao Profile Picture
    renatoromao 6,762 on at
    Re: create an expression

    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")
    ))

     

Helpful resources

Quick Links

Exciting News for Copilot Studio Communi…

Get ready to experience a whole new level of engagement with the Copilot Studio…

Celebrating the May Super User of the…

LaurensM is an exceptional contributor to the Power Platform Community…

Check out the Copilot Studio Cookbook…

We are excited to announce our new Copilot Cookbook Gallery in the Community…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 137,998

#2
RandyHayes Profile Picture

RandyHayes 76,308

#3
Pstork1 Profile Picture

Pstork1 63,059

Leaderboard