Trigger condition expression example Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/tag/trigger-condition-expression-example/ Microsoft Dynamics CRM . Microsoft Power Platform Tue, 09 Jun 2020 18:23:02 +0000 en-US hourly 1 https://wordpress.org/?v=6.5.5 https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/04/cropped-Microsoftdynamics365-blogs.png?fit=32%2C32 Trigger condition expression example Archives - Microsoft Dynamics 365 Blog http://microsoftdynamics.in/tag/trigger-condition-expression-example/ 32 32 176351444 Trigger condition expression example for each field Datatype in Power Automate http://microsoftdynamics.in/2020/06/09/trigger-condition-expression-example-for-each-datatype-in-power-automate/ Tue, 09 Jun 2020 18:20:53 +0000 http://microsoftdynamics.in/?p=3539 The post Trigger condition expression example for each field Datatype in Power Automate appeared first on Microsoft Dynamics 365 Blog.

]]>

This post is on how to add a trigger condition and how are the expression used as TriggerBody()

We will divide the example into below points, As by name itself it states Flow will only run when the trigger condition is matched
EXAMPLE:  We want the flow to trigger only when case status = 2 where our flow trigger is “When a record  is created”

  1. Trigger flow on condition of OptionSet Value, option Label or Boolean field
  2. Trigger flow on condition of Lookup name, GUID, Type or Customer Type
  3. Trigger flow on the condition to check contains the operation
  4. Trigger flow on condition to check GreaterOrEqual, LessOrEqual
  5. Trigger condition “OR” “AND” Logical Operators example
  6. Troubleshot: check TriggerBody() Body with fields and Values
https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/06/img_5edfa63a58874.png?fit=1623%2C893

Check1: Trigger flow on condition of OptionSet Value , option Label or Boolean field

  • If we check triggerbody()
    Optionset will have two variables  in the body , we can use either of them to set a trigger condition
    example :
    “statecode” : 1
    “_statecode_label” : “Resolved”

    @equals(triggerBody()?[‘statecode’],1)
    @equals(triggerBody()?[‘_statecode_label’],’Resolved’)

  • For Boolean field its will be field schema name = true / false
    example :
    “new_iscontact” : true

 

@equals(triggerBody()?[‘new_iscontact’],true)

 

Check2: : Trigger flow on condition of Lookup name, GUID , Type or Customer Type

  • If we check triggerbody()
    The lookup will have two variables in the body , we can use either of them to set a trigger condition
    example :
    “_new_lookup_value” : <GUID>
    “_new_lookup_type” : <Entity> i.e contacts , accounts , businessunites

    @equals(triggerBody()?[‘_new_lookup_value’], ‘3184b10e-eaa8-ea11-a812-000d3a5a77a3’)
    @equals(triggerBody()?[‘_new_lookup_type’],’contacts’)

  • Same goes for Customer field, Owner field
    example :
    “_ownerid_type”: systemusers

@equals(triggerBody()?[‘_ownerid_type’],’systemusers’)
@equals(triggerBody()?[‘ _customerid_type’],’accounts’)

 

Check3: Trigger flow on the condition to check contains operation

  • Trigger condition just need TRUE or FALSE value to trigger the flow and we may also need our power automate flow to run when Title contain Refund it should create priority 1 case.if title contains refund as text, if it contains refund in title output will be TRUE otherwise False

    @contains(triggerBody()?[‘title’],’refund’)

Check4: Trigger flow on condition to check GreaterOrEqual, LessOrEqual

  • Trigger condition just need TRUE or FALSE value to trigger the flow and we may also need our power automate flow to run when NPS Score  is GreaterOrEqual to 9 or LessOrEqual5

    @greaterOrEquals(triggerBody()?[‘msfp_npsscore’],9)
    @lessOrEquals(triggerBody()?[‘msfp_npsscore’],5)

Check5: Trigger condition "OR" "AND" Logical Operators example

  • Condition like if Title contains Refund OR/AND  Credit

@or(contains(triggerBody()?[‘title’],’Refund’),contains(triggerBody()?[‘title’],’Credit’))
@and(contains(triggerBody()?[‘title’],’Refund’),contains(triggerBody()?[‘title’],’Credit’))

Troubleshot: check TriggerBody() Body with fields and Values

  • There were chances with OOB entities like Ai builder or Forms pro which have some background workflow on create or update  and we might be putting a condition where value might not be in BODY of triggerbody()
  • We can check and successful or failed history for body content
https://i0.wp.com/microsoftdynamics.in/wp-content/uploads/2020/06/img_5edfcd57af3bd.png?fit=1308%2C773

The post Trigger condition expression example for each field Datatype in Power Automate appeared first on Microsoft Dynamics 365 Blog.

]]>
3539