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

Perform Multiple Actions Based on If Condition

Hi,

 

I am trying to build an app where i have added Approve button in the form screen. I have used patch function to update the field values as below. What is the condition is: If the Item is 'Complex' then do 1,2,3 actions else do 4,5,6. 

 

Set(
    VarIntake,
    If(
        DataCardValue73.Selected.Value = "Complex",
        Patch(
            'List Name',
            VarIntake,
            {
                Status: {Value: "Next Review"},
                IntakeReviewComment: intComments.Text
            }
        ),
        Patch(
            'List Name',
            VarIntake,
            {
                Status: {Value: "Approved"},
                IntakeReviewComment: intComments.Text
            }
        )
    )
)

 

I am able to perform the single action if a specific condition is true, however I want more 2 actions in each condition as below.

 

If( Type = "Complex",
           1. Patch {Staus: ABC},
           2. Send Email to Person A
           3. Send Email to Person B,
     Else,
           4. Patch {Status: EFG}
           5. Send Email to Person C
           6. Send Email to Person D
  ) 

I tried segregating the 1, 2, 3 using &&, ||, ;;, ;, but somehow getting error. Can anyone please help how to combine multiple actions in true and false conditions?

 

Thanks,

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Dual Super User III
Dual Super User III

Re: Perform Multiple Actions Based on If Condition

I don't believe there is any way to embed multiple statements inside an If() statement.  The only way to do what you are asking is to have a set of If() statements with one for each set of actions.

If( Type = "Complex",
           1. Patch {Staus: ABC},
     Else,
           4. Patch {Status: EFG}
  ) ;
If( Type = "Complex",
           2. Send Email to Person A
     Else,
           5. Send Email to Person C
  ) ;
If( Type = "Complex",
            3. Send Email to Person B,
     Else,
            6. Send Email to Person D
  ) 
 
 


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted
Memorable Member
Memorable Member

Re: Perform Multiple Actions Based on If Condition

Hi @AkshayManke ,

below the Code For your requirement.

If(ThisItem.Complexity.Value="Simple",Patch( 
    TestAkshay,{
        ID:ThisItem.ID,
        Status:{
            Value:"Approved",
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
        }
    }
);Office365Outlook.SendEmailV2(ThisItem.'Created By'.Email,"Your Request is Apptoved","Hi your request is approved",{Importance:"High"}),Patch( 
    TestAkshay,{
        ID:ThisItem.ID,
        Status:{
            Value:"Under Review",
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference"
        }
    }
);Office365Outlook.SendEmailV2(ThisItem.'Created By'.Email,"Your Request is Under Review","Hi your request is approved",{Importance:"High"}))

 Thanks,
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

View solution in original post

15 REPLIES 15
Highlighted
Dual Super User III
Dual Super User III

Re: Perform Multiple Actions Based on If Condition

I don't believe there is any way to embed multiple statements inside an If() statement.  The only way to do what you are asking is to have a set of If() statements with one for each set of actions.

If( Type = "Complex",
           1. Patch {Staus: ABC},
     Else,
           4. Patch {Status: EFG}
  ) ;
If( Type = "Complex",
           2. Send Email to Person A
     Else,
           5. Send Email to Person C
  ) ;
If( Type = "Complex",
            3. Send Email to Person B,
     Else,
            6. Send Email to Person D
  ) 
 
 


-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

View solution in original post

Highlighted
Memorable Member
Memorable Member

Re: Perform Multiple Actions Based on If Condition

Hi @AkshayManke ,

You can perform multiple actions

If(ThisItem.ID=1,UpdateContext({ValueNew:!ValueNew});Notify("Value is "&ValueNew,NotificationType.Success),Notify("Some Error",NotificationType.Error))

like below using if condition.

just Use ";" for Actions.

Thanks
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Helper V
Helper V

Re: Perform Multiple Actions Based on If Condition

Hi Vijay, @VijayTailor,

 

I tried using the below but the formula is giving error. Can you please let me know where i am wrong?

IfMultiple.JPG

 

 

 

 

Regards,

Akshay

Highlighted
Memorable Member
Memorable Member

Re: Perform Multiple Actions Based on If Condition

Please Remove "Big": and "Small":

your code work once you removed that
Highlighted
Helper V
Helper V

Re: Perform Multiple Actions Based on If Condition

But i need both the actions based on the condition. Fore clarity i have added the blow snap. In the input text field i need Big/Small to be written and also i need the notification in the screen, hence as suggested by you i have added a semicolon ";" after each action in true and false. Is this correct?

 

IfMultiple1.JPG

Highlighted
Memorable Member
Memorable Member

Re: Perform Multiple Actions Based on If Condition

Hi @AkshayManke 

please have a look into the below URL, Hope that is fit for your requirement and resolve your issue
https://drive.google.com/file/d/1Oi9hnXS7h4Y2EVQZxuuyPiqlosyWV9-m/view

For reference also attached the App.
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Highlighted
Helper V
Helper V

Re: Perform Multiple Actions Based on If Condition

Hi Vijay, @VijayTailor 

This is exactly what i want. But could you please share the code as well so that i can refer it?

Regards,

Highlighted
Memorable Member
Memorable Member

Re: Perform Multiple Actions Based on If Condition

Already attached the Full App that I implemented for testing.

See the yellow highlighted.

VijayTailor_0-1601229180560.png

Thanks

Highlighted
Helper V
Helper V

Re: Perform Multiple Actions Based on If Condition

Sorry missed it. I downloaded the app and tried the formula it is working in your application however it is not working in my env. Don't know why. I tried with various combinations. Trying it again and will get back to you with the result shortly.

 

Thanks and Regards,

Akshay

 

 

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.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Top Solution Authors
Top Kudoed Authors
Users online (10,485)