Transfer the owner of catalog items if the owner is deactivated in ServiceNow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 04:27 AM
Hello ,
I have a requirement , where if the owner of the catalog item becomes inactive then the catalog item ownership should be transferred to the Manager of the assignment group to which the catalog item is assigned .
How can I implement this functionality ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 04:35 AM
Hi @Pooja Khatri ,
I was searching in Catalog Item. but I am not able to find the Assignment group field. As you mentioned that the catalog Item is assigned to the Assignment group, is it a custom field created?
In that case, you can write a business rule and achieve this. If you need more help on this can you please provide the conformation of the Assignment group field name and where its located, so I can develop and give the script.
Mark helpful if it helps in solving your query.
Regards,
Johns
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 04:40 AM
Hi @Johns Marokky .. yes the assignment group field is a custom field .. the name of the field is Assignment group itself and it is located in sys_user_group table itself .. yes can you please help me with the script .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2023 07:10 AM
Hi @Pooja Khatri,
Please create a business rule on the sys_user with a filter as Active is false table as per the below image.
go to advanced and add the condition as per below script.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var catGr = new GlideRecord('sc_cat_item');
catGr.addQuery('owner',current.sys_id);
catGr.query();
while(catGr.next()){
catGr.owner = catGr.u_assignment_group.manager; //give the correct field name for assignment group
catGr.update();
}
})(current, previous);
I think this would help in solving your query.
Mark helpful and correct if it helps in solving your query.
Regards,
Johns