Fix Script

Shreshta_happy
Tera Contributor

They are some inflight tasks that I need to reassign to the other group.

i have written this fix script:

var techUpgrade= new GlideRecord('case table');
techUpgrade.addEncodedQuery('u_tech_upgrade_type=');
techUpgrade.query();
while (techUpgrade.next()) {
    gs.log("it is for non tu" + techUpgrade.number);
    var GroupUpdate = new GlideRecord('task table');
    GroupUpdate .addQuery('u_parent', techUpgrade.sys_id);
GroupUpdate .addQuery('u_type', 'task');
    GroupUpdate .addQuery('u_assigned_group', 'IN', 'f53cecacdbf8f5109aa69reerrwer');
    GroupUpdate .query();
    if (GroupUpdate .next()) {
        gs.log("checking for the second remtask + techUpgrade.number);
        GroupUpdate .seValue('u_assigned_group ', '6ebd91f387593510f484b806dabdfdf443');
        GroupUpdate .setWorkflow(false);
        GroupUpdate .update();
 
    }
}
 
The logs are getting executed but the group is not getting updated
Please help.

 

14 REPLIES 14

@psphanindrakuma Good catch mate. @Shreshta_happy Please use correct sys_id here.

@Shreshta_happy 

And also you can use 

techUpgrade.addNullQuery('u_tech_upgrade_type');

 

I have given a dummy sys_id here. 

newhand
Mega Sage

HI@Shreshta_happy 
Did you  uncheck  the "Record for rollback" check box ?

 

Please mark my answer as correct and helpful based on Impact.

Ankur Bawiskar
Tera Patron
Tera Patron

@Shreshta_happy 

there is a space after your field name and I removed it

please use this line

GroupUpdate .seValue('u_assigned_group', '6ebd91f387593510f484b806dabdfdf443');

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader