Catalog Item Variables in Workflow Notification

nancyhz
Mega Contributor


I was asked to send a notification after task is closed in workflow.   The requirement is to use some Catalog Item form Variable values in email body. I don't how to get variable values in notification body.   Can I use :   ${workflow.variables.variableName} in email body?

 

Variable.png

12 REPLIES 12

marcguy
ServiceNow Employee
ServiceNow Employee

I would try current.variables.project_manager.sys_id and that should then add them as an approver


marcguy
ServiceNow Employee
ServiceNow Employee

I mean add their user sys_id sorry


nancyhz
Mega Contributor

I did try both your suggestion using , but no luck. no email sent to project manager.   I do see sys id returned in (gs.log(answer))


answer =current.variables.project_manager.sys_id;



<mail_script>


var supMail = current.variables.project_manager.email;


var supName = current.variables.project_manager.getDisplayValue();


email.addAddress("bcc", supMail, supName);


</mail_script>


Or


answer =current.variables.project_manager.sys_id;


I attached screenshot for your reference


Notification.png


Did you happen to check with the project manager to see if they got the email? One thing I forgot to mention, is that because it's BCC, nothing will show up in the logs on the ticket saying it was sent to them.   But if you did, and it didn't work, sorry. That script is working in a few of our workflows so I'm not sure why it wouldn't on yours. Maybe it's a version thing. We are still on Berlin.


nancyhz
Mega Contributor

It did work, but somehow bcc email not showup in email log.   Many thanks!