Need help setting SCTASK description

curbabel
Tera Contributor

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.
Picture77.png
However, when I impersonate a different user, the script does not work.
Picture76.png

Can someone please help me understand what I'm doing incorrectly?

4 REPLIES 4

SanjivMeher
Kilo Patron
Kilo Patron

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.

Danish Bhairag2
Tera Sage
Tera Sage

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

Vishal Birajdar
Giga Sage

Hi @curbabel ,

 

Can you put "Timer"  activity (Duration for 1 sec) before "Catalog task" activity and check.

 

VishalBirajdar7_0-1695357481604.png

 

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates

Ankur Bawiskar
Tera Patron
Tera Patron

@curbabel 

did you try to print the variable value using gs.info() and see what comes for that user?

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