Is it possible to provide the approval deletegate access to somone else within a workflow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 07:58 AM - edited 04-01-2025 07:58 AM
We have a change request workflow where through "Approval - user" activity the approval triggers to "Service Owner" and this service user is dynamic which comes from the CI record added to the Change request.
As per requirement we should always provide the access to service owner that he can delegate his approval of this particular request to someone else, it it possible? if yes then how.
below is the activity
Below is the script which is added under this activity.
answer = [];
var grmanaged = new GlideRecord("task_cmdb_ci_service");
grmanaged.addQuery("task",current.sys_id);
grmanaged.query();
while(grmanaged.next()) {
answer.push(grmanaged.cmdb_ci_service.owned_by);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 08:07 AM
Hello @VIKAS MISHRA
Yes, below 👇 you can add into above "Run script" activity or you can create a new one.
var grManaged = new GlideRecord("task_cmdb_ci_service");
grManaged.addQuery("task", current.sys_id);
grManaged.query();
while (grManaged.next()) {
var owner = grManaged.cmdb_ci_service.owned_by;
if (owner) {
var grDelegate = new GlideRecord("sys_user_delegate");
grDelegate.initialize();
grDelegate.user = owner; // Assign the owner as the delegator
grDelegate.delegate = "<delegate_sys_id>"; // Replace with the delegate's sys_id
grDelegate.start_date = gs.nowDateTime();
grDelegate.end_date = gs.dateGenerate(gs.daysAgo(-30), "00:00:00"); // 30 days from today
grDelegate.insert();
}
}
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 08:00 PM
Thanks for your reply
but how can i add delegate's sys_id as mentioned in below line of code. it should dynamic check the sys id if service owner wants to delegate his approval to someone
grDelegate.delegate = "<delegate_sys_id>"; // Replace with the delegate's sys_id
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 08:09 PM
Hello @VIKAS MISHRA
Then make it dynamic, you can put the whatever field it is on which delegate is stored by owner.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 08:14 PM
you should have delegate configured for those owners already in "sys_user_delegate" table
If you dynamically create records into that table, the table will become huge and difficult to maintain.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader