Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

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