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

Hi @Ankur Bawiskar ,

 

I have changed all the of them , but it is still not working

Can you please check on this

@Shreshta_happy 

 

Does the log printing?

 

@Shreshta_happy 

Please share your updated script

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

psphanindrakuma
Tera Guru
Tera Guru

@Shreshta_happy 

Please correct typo where you setting grourp.
GroupUpdate .setValue('u_assigned_group ', '6ebd91f387593510f484b806dabdfdf443');

Please mark my answer as correct and helpful it it helps

psphanindrakuma
Tera Guru
Tera Guru

@Shreshta_happy 

 

The reason why this script not working is

1.  GroupUpdate .seValue('u_assigned_group ', '6ebd91f387593510f484b806dabdfdf443');
there is "t" missing in statemant

2. GroupUpdate .addQuery('u_assigned_group', 'IN', 'f53cecacdbf8f5109aa69reerrwer');

sysid is wrong. it has 29 charectors instead 32.

use"STARTSWITH" or exact 32 charector sysId

Please mark my answer as correct and helpful if it solves your issue

 

Thanks,

Phanindra.