Skip to main content
Mitratech Success Center

Client Support Center

Need help? Click a product group below to select your application and get access to knowledge articles, webinars, training content, and release notes or to contact our support team.

Authorized users - log in to create a ticket, view tickets status and check your success plan details.

 

IMS Conditionally Mandatory with condition

IMS conditionallyMandatory

This guide provides code sample for conditionallyMandatory in IMS while testing a condition

IMS validation can provide a way to force a user to enter in a response dependent on a previous response.

As an example if response 1 is yes (yes is the condition) then a response is required for question 2. 

 

In the code below the two attributes involved are

EUCStatus

DecoReason

 

If EUCStatus's answer is Decommissioned then the attribute DecoReason requires a response before been able to save or proceed.

Method 1 with everything in just the rule:

Use the JavaScript Boolean function to typecast and test the condition.

 
  <Rule RuleName="CM_Att_DecoReason" RuleDescription="" RuleType="Validation" MessageGlobal="Your Attention is Required!" MessageLocal="Your Attention is Required!"><![CDATA[
   (function(){
   
     return Boolean(s("EUCStatus") === "Decommissioned") && !(s("DecoReason"));
   })()
  ]]></Rule>

 

Method 2

Use a function with an if statement to typecast instead of the Boolean function.

In the rule setup place this code

 function IsEUCStatusDecomFX(){

  if(s("EUCStatus") === "Decommissioned")
    return true;
   else return false;
  }

 

In the rule section place this Validation rule

  <Rule RuleName="CM_Att_DecoReason" RuleDescription="" RuleType="Validation" MessageGlobal="Your Attention is Required!" MessageLocal="Your Attention is Required!"><![CDATA[
       IsEUCStatusDecomFX() && !s("DecoReason")
  ]]></Rule>

The end result is that if IsEUCStatusDecomFX returns true and DecoReason is not defined an exclamation mark will notify the end user that their attention is required.

 

  • Was this article helpful?