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.

Change Task cannot be assigned to the same person as the previous Catalog Task.

WilteS
Tera Contributor
What do i wrong?
 
I made a business rule for a change so thats not posible the same user do both task. 
 
(function executeRule(current, previous /*null when async*/) {
var tsk = new GlideRecord('change_task');
tsk.addQuery('Parent', '==', current.Parent);
tsk.addQuery('sys_id', '!=', current.sys_id);
tsk.query();
if (tsk.next()) {
    if (tsk.assigned_to == current.assigned_to) {
        gs.addErrorMessage('Change Task cannot be assigned to the same person as the previous Catalog Task.');
        current.setAbortAction(true);
    }
  
}
5 REPLIES 5

WilteS
Tera Contributor

the current.parent is empty in the code. but is filled in the table. the table value isn't give in the current.parent