- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2022 11:10 PM
Hi everyone,
How do you set approval in workflow?
I would like to set the approver to be from variable?
the catalog item variable is manager and value will be from manager field.
Thanks in advanced.
Solved! Go to Solution.
- Labels:
-
Service Catalog
-
Service Portal
-
Workflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 11:22 PM
If this workflow is on request then you should query the RITM details and use them
somethink like this.
var answer=[];
var grScReqItem = new GlideRecord('sc_req_item');
grScReqItem.addEncodedQuery("request="+current.sys_id+"^cat_item=1391a4db070630100b36f6fd7c1ed0c2");//map you catalog item sysid here.
grScReqItem.query();
if (grScReqItem.next()) {
answer.push(grScReqItem.variables.manager.toString());
}
for below line you should modify the highlated part with the catalog item sysid you want to fetch manager details from.
grScReqItem.addEncodedQuery("request="+current.sys_id+"^cat_item=1391a4db070630100b36f6fd7c1ed0c2");
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 11:22 PM
If this workflow is on request then you should query the RITM details and use them
somethink like this.
var answer=[];
var grScReqItem = new GlideRecord('sc_req_item');
grScReqItem.addEncodedQuery("request="+current.sys_id+"^cat_item=1391a4db070630100b36f6fd7c1ed0c2");//map you catalog item sysid here.
grScReqItem.query();
if (grScReqItem.next()) {
answer.push(grScReqItem.variables.manager.toString());
}
for below line you should modify the highlated part with the catalog item sysid you want to fetch manager details from.
grScReqItem.addEncodedQuery("request="+current.sys_id+"^cat_item=1391a4db070630100b36f6fd7c1ed0c2");
Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Rohila V
2022-25 ServiceNow Community MVP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-08-2022 03:24 PM
Hi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 11:11 PM
Hi,
I assume your workflow is on RITM table
then this should work fine
Did you add logs what came in manager variable?
answer = [];
answer.push(current.variables.manager.toString());
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 11:17 PM
Hi
No, this is on sc_request
This is a follow up after the If statement.
No , I did not.
variable name is manager and part of variable set = user_profile_set
manager is reference to sys_user table
I tried below but doesn't work
answer.push(current.variables.manager.toString());
OR
answer.push(gr.variables.manager.toString());
OR
answer.push(gr.variables.manager.getValue());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-07-2022 11:23 PM
then query RITM
answer = [];
var gr = new GlideRecord("sc_req_item");
gr.addQuery("request", current.request);
gr.query();
if (gr.next()) {
answer.push(gr.variables.manager.toString());
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader