- 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 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 01:18 AM
The above code is not working,
I have written BR after update on user(sys_user) table and condition given when active is false.
created one field (string type) on user table task he has inactive.
var sysID = [];
var gr = new GlideRecord("task");
gr.addQuery("assigned_to", current.getUniqueValue());
gr.query();
while (gr.next()) {
sysID.push(gr.getValue("number"));
}
current.u_task_he_has_inactive= sysID.toString(); //give your field name where you want to update the ticket numbers...
current.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-10-2023 02:20 PM
I have a similar requirement that I thought you might be willing to assist me with solution-ing. I have been asked to send a notification upon user deactivation to alert their manager of the ACTIVE tasks that need to be reassigned to another assignment group member. Should I be concerned about performance issues when querying the 'task' table? Please let me know your thoughts. Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-06-2022 02:24 AM
Hi Feroz,
Keep some logs and check what is not working.
BTW do you want to put only the active tasks or all of the tasks?
If it is active tasks then add gr.addActiveQuery(); before the gr.query();
Thanks,
Murthy
Murthy