Need help setting SCTASK description
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 03:00 PM
Hello, can someone help me with the following: On my workflow I am trying to set the SCTASK description based on a couple of variables of a catalog item using the following script:
task.description = 'Please create a Standard Change to ' + current.variables.request_type + ' on MTs ' + current.variables.internal_or_external_dns + ' DNS. Review the Request Details for specific changes required. NOTE: If applicable, review the attached file since there may be multiple changes required for this request.';
When I test it out on my end, it works perfectly fine.
However, when I impersonate a different user, the script does not work.
Can someone please help me understand what I'm doing incorrectly?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 05:02 PM
I dont see anything wrong with the workflow script. You may need to put few log statements to see if you are getting values in these variables. You can add gs.info('++++request_type++++'+current.variables.request_type);. May be these variables are not getting populated for the impersonated user. Check the variables in requested Item records .
current.variables.request_type
current.variables.internal_or_external_dns
.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 09:22 PM
Hi @curbabel ,
You can try storing those values in workflow scratchpad variable like workflow.scratchpad.requestType & then use those scratchpad values in the task node script area.
Please mark my answer helpful & accepted if it resolves you issue.
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 09:38 PM
Hi @curbabel ,
Can you put "Timer" activity (Duration for 1 sec) before "Catalog task" activity and check.
ServiceNow Developer
I know one thing, and that is that I know nothing.
- Socrates
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-21-2023 10:05 PM
did you try to print the variable value using gs.info() and see what comes for that user?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader