Create the Business Rule

  1. Create a new Business Rule:
  2. Name: Lab 5.2 RCA Included
    Table: Incident [incident]
    Active: Selected
    Advanced: Selected
    When: before
    Order: 125
    Insert: Selected
    Update: Selected
    
  3. Within the executeRule() function in the Script field, type try followed by the <tab> key to insert the try Syntax Editor Macro (created in Lab 2.1)
  4. Select Format Code icon on the Syntax Editor toolbar to properly align the script
  5. Update the statement in the catch block to use the server-side gs.log() method instead of the client-side g_form.addErrorMessage() method:
  6. (function executeRule(current, previous /*null when async*/){
        try{
        }
        catch(err){
            gs.log("A Runtime error occured: " + err);
        }
    })(current, previous);
    
  7. Examine and write the script in the try:
  8. (function executeRule(current, previous /*null when async*/){
        try{
            if(current.u_rca.nil() && current.u_rca_included){
                current.u_rca_included = false;
            }
            else if(!current.u_rca.nil() && !current.u_rca_included){
                current.u_rca_included = true;
            }
        }
        catch(err){
            gs.log("A Runtime error occured: " + err);
        }
    })(current, previous);
    
  9. Select Submit

results matching ""

    No results matching ""