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

Sateesh Kumar D
ServiceNow Employee
ServiceNow Employee

Hello,

The scope of workflow scratchpad are withing the same workflow, so make sure you are setting workflow.scratchpad.user_name and getting it in same workflow. If you setting it in RITM workflow and trying to get from request workflow it may not work.

If you are trying to get from same workflow , I don't see any reason why this would not work. Try with different variable in scratchpad like workflow.scratchpad.usrname just to eliminate case that it could be used by some other activity.

If you have the user's name in any varialble, you can use current.variables.[variableName] to retrieve the value from variables.