Search code examples
dynamics-crm-2013unified-service-desk

Conditional Action Call


I'm building an application using CRM 2013 Unified Service Desk (USD). Right now, I'm creating a conditional action call from a hosted control to another. So far I got it working with a single expression, like:

"[[Data1]]" == "Value1"

But I've gone further down the rabbit's hole and now I need to query two values with an OR operator:

"[[Data1]]" == "Value1" || "[[Data2]]" == "Value2"

While the first example works fine, using the || operator does not. I've already tried using some variations, like expr OR expr, but the evaluation fails.

There's no documentation on MSDN covering the conditional part of an action call, so I need help figuring this one out.


Solution

  • As you have discovered, USD translates your key's to their text versions and then passes it to the javascript converter. so :

    // where mykey1 = "Test" (string)  and mykey2 = true (bool)
    // Success condition
    "[[mykey1]]" == "Test" || "[[mykey2]]" == "True"
    

    if you were working with a lookup and you want to only run the action if the lookup is pointed at the business unit and the name of the business unit is defaultorg... you would use this:

    // where [[$User.businessunitid]] reference to a business unit
    "[[$User.businessunitid.logicalname]]" == "businessunit" && "[[$User.businessunitid.name]]" == "defaultorg"
    

    Hope that helps.