Some PDIs are currently unavailable, and PDI actions are paused. View the latest updates here. Read More

Apply business rule to assign branch manager based on branch field

MitishaV
Tera Contributor
(function executeRule(current, previous /*null when async*/) {

    var branch = current.u_branch;
    var Record = new GlideRecord('u_branch');
   
    Record.addQuery('u_branch',branch);
    Record.query();
   
    if(Record.next())
    {
        var branch_manager = Record.getDisplayBox('u_branch_manager').value;
        current.assigned_to = branch_manager;
    }


})(current, previous);
1 REPLY 1

Shruti
Giga Sage
  (function executeRule(current, previous /*null when async*/ ) {
      var branch = current.u_branch;
      var rec = new GlideRecord('u_branch');
      rec.addQuery('u_branch', branch);
      rec.query();
      if (rec.next()) {
          current.assigned_to = rec.getValue('u_branch_manager');
      }
  })(current, previous);