Adding html text to an Approval before it is sent to the approver when a specific item is ordered

Lon Landry4
Mega Sage

I am working on a flow in Flow Designer.
I am looking to find a way to add html text to an Approval Email Notification before it is sent to the approver for a specific catalog item.
ItemIssueAproval.png

 

Is it possible to add text to the Approval before it is sent to the approver?
if so, How?

Thanks for your time,

Lon

 

 

13 REPLIES 13

Allen Andreas
Administrator
Administrator

Hi,

You can create a mail script and look at the current record to see if it's the specific catalog item you need to add the verbiage to. In the mail script, you have access to the "current" object and so using the approval, you can dot-walk to the catalog item such as:

if (current.sysapproval.cat_item.name = "Standard Laptop") {
template.print("Hello world!");
} 

Then in your notification body, you can call the mail script and it'll add it to your message such as:

${mail_script:name_of_mail_script}

https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/script/server-scripting/concept/c_... 

 

You may want to review referring to this by the name as the name of the catalog item could change, so you could instead refer to it by the sys_id using current.sysapproval.cat_item = 'sys_id' or even better, create a string system property, add your catalog item sys_id to it and then call the property in script like: current.sysapproval.cat_item = gs.getProperty('property_name')


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

I am confused by instruction Then in your notification body.
I am trying to add this to the default approver message, but only for this item.

Hi,

The notification that goes out for this scenario, open that record and navigate to the body and paste the mail script line, similar to what I mentioned, in the notification where you want it to show.

 

Please explain your thoughts as to how you're confused so that I can help explain further.

 

As I asked in your other thread that was a duplicate of this, please perhaps share screenshots of what you're talking about, where you're thinking, why you're confused, etc. and I can help further.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

This is the oob Ask for approval step I am talking about.
askForApproval.png

 

So I cannot edit this directly...I need to update the email after it is created but before it is sent.