- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2022 12:49 AM
I have a field free text field in user table. Once the user's account is deactivated. We have to pull the list of ticket numbers assigned to the user and paste them in the newly created field(free text field in user table) on the user record.
Please help me with approach and scripting. Thanks in advance.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2022 01:00 AM
HI @Feroz
Create after update business rule and give condition as active is false and use below script:
(function executeRule(current, previous /*null when async*/ ) {
var sysID = [];
var gr = new GlideRecord("task");
gr.addQuery("assigned_to", current.getUniqueValue());
gr.query();
while (gr.next()) {
sysID.push(gr.getValue("number"));
}
current.field_name= sysID.toString(); //give your field name where you want to update the ticket numbers...
current.update();
})(current, previous);
Hope it helps..
Thanks,
Murthy
Murthy
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2022 03:46 AM
Sorry it was my mistake, I have written two business rules so it is over riding . Now the code is working fine.