How can I put custom text in an approval email?

james_cox
Kilo Contributor

Hi There,

I'd like to include additional information in an approval notification in my workflow. For instance, a user will make a selection, and I would like to use the description to populate part of the approval request that goes to the manager. I'm sure it can be done via template/javascript, but any guidance is greatly appreciated.

James

1 ACCEPTED SOLUTION

You just need to dot-walk to the variables you need. The sysapproval record is the "Approval For" information.


Example:


Request Type: ${sysapproval.cat_item}


Requested For: ${sysapproval.u_requested_for}


Short Description: ${sysapproval.variables.short_description}


Comments: ${sysapproval.variables.comments}


View solution in original post

9 REPLIES 9

kenappell
Kilo Guru

Hi James,



Have you looked at scripting for notifications? An approval email is just a type of notification.


Scripting for Email Notifications - ServiceNow Wiki


Thanks Ken,


I have been investigating that today. I dont necessarily want to edit the default notification of the approval request, just the one for these specific types of requests/requests items. Does that mean i will need to create a specific notification for these catalog items? And if so, how do I ensure that this one is used?



Thanks again!


James


You can create a template to call the script or just call the script from the notification. If you make the script smart, you can use the existing approval notification and the script will only execute based on your criteria. Otherwise, you can create (copy) a new notification just for these catalog items and set the trigger criteria accordingly.


Email Notifications - ServiceNow Wiki


Thanks again Ken!


I've got my separate notifications set up that fire based on the version of the workflow that's being used, as well as the mail script within them.



Can you provide any guidance on the javascript that needs to be used to get the description (or any other values for that matter) of the request/requested item ? I've been pounding away at it and cant seem to get anything to work.



James