Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to get the user id of the Opened by to Created by in sctask (in workflow script)

ss123
Tera Contributor

Hi everyone,

 

I would like to check if how can I get the user id of the Opened by in SCTask to Created by field.

Here's a screenshot for reference.

SabrinaSalazar_0-1689306038835.png

 

The script i'm using in  workflow catalog task is not working:

task.sys_created_by = task.opened_by.user_id;

 

 

Thanks in advance!

12 REPLIES 12

Hi @Rahul Talreja , unfortunately, it's not getting the user id of the requested by

Hi @ss123 ,
try with,

task.sys_created_by = current.variables.requested_by.user_id;

also make sure you are using correct variable names according to your setup.

Please mark my response correct/helpful as applicable!
Thanks and Regards,
Rahul

thanks but still not working. Is there anything else backend that's updating this field? 

@Rahul Talreja