Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Update assigned to field

Shaik22
Tera Expert

Hi,

 

Control owner field is on Control(sn_compliance_control) table. Assigned To and Evidence Execution fields on Control Executor(sn_audit_control_compliance) table. If we select control owner, assigned to have update, Only for Evidence Execution field is Manual. Wrote a script but it is not updating the assigned to field. Any help!

 

Table : control[sn_compliance_control]

After(Insert,Update) business rule

Condition : Control owner changes

Script: 

var controlGR = new GlideRecord('sn_audit_control_execution');
    controlGR.addQuery('u_evidence_execution', 'Manual');
    controlGR.query();
    if (controlGR.next()) {
        controlGR.assigned_to = current.u_control_owner;
        controlGR.update();
    }

 

 

 

11 REPLIES 11

 var controlGR = new GlideRecord('sn_audit_control_execution');
    controlGR.addQuery('u_evidence_execution', 'Manual');
    controlGR.query();
    if (controlGR.next()) {
        gs.info('this was executed');
        //controlGR.assigned_to = current.u_control_executor;
        controlGR.assigned_to = current.getValue('u_control_executor');
        gs.info('assigned to updated:'+ controlGR.assigned_to);
       controlGR.update();
    } - Field is not updated.
After(Insert,update)BR
When to run: Control Executor changes

Does Assigned to have any reference qualifier that might be blocking this?

is the user you are trying to assign part of assignment group?

-Anurag