Need some help on default REQ and unique RITM level workflows
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-22-2023 11:56 PM - edited 11-23-2023 12:33 AM
Hi All & @Ankur Bawiskar ,
Can anyone please help us on the below issue.
Firstly we have one default workflow and it's run on all the REQ tickets level. [Refer below image] and we have one Timer activity as 1 second just to create the RITM tickets and it's working fine.
But we recently developed one Catalog item with a workflow [Refer below image], and RITM workflow level we have used the below line on Run script activity level to get the requesting user name.
workflow.scratchpad.user_name = gs.getUserName();
And now due to using the Timer activity on REQ workflow level, we're getting the user_name as "system" but we want the requesting user should be returned.
Note: If we remove the Time activity from default REQ workflow then it's working fine for above the requirement but we want to keep the "Timer" activity and fulfill the above requirement .
Advance thanks,
AR
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 01:07 AM
then why not use GlideRecord and get the value?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 01:14 AM - edited 11-23-2023 02:19 AM
Hi Ankur,
Thanks for the response.
As you mentioned, We're running the below script on RITM workflow Run script activity level but we're not getting any value.
Could you please check.
var gr1 = new GlideRecord('sc_req_item');
gr1.addQuery('request', current.sys_id);
gr1.query();
while (gr1.next()) {
var reqUser = gr.getDisplayValue('opened_by');
}
workflow.info(reqUser); // we're getting as undefined
workflow.scratchpad.user_name = reqUser;
Advance thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 02:36 AM
Hello,
If you are doing this run script on RITM workflow you can just use current.getDisplayValue("opened_by")
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-23-2023 02:52 AM
Hi Sateesh,
Thanks for the response.
If we just mention like "workflow.scratchpad.user_name = current.getDisplayValue("opened_by");" then we're again getting user_name as "system".
Could you pls help us here.
Advance thanks.