Need some help on default REQ and unique RITM level workflows

ar1
Kilo Sage

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. 

ar1_0-1700725238042.png

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 .

ar1_1-1700725423155.png



Advance thanks,
AR

 

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@ar1 

then why not use GlideRecord and get the value?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

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.

Sateesh Kumar D
ServiceNow Employee
ServiceNow Employee

Hello,

If you are doing this run script on RITM workflow you can just use current.getDisplayValue("opened_by")

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.