Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Customize approval emails with requested item variables

Chris135
Giga Contributor

Hello everyone,

I am trying to customize an approval email notification with variables from a requested item. I modified the requested_items_summary_with_options email script with the requested item's sys_id. I then called the mail script in the notification email but the variables show up blank when the manager receives the email.

Here is the notification data I am putting in the body:

 

${mail_script:requested_items_summary_with_options}
 
Requesting User: ${variables.requested_for}

Request Type: ${variables.request_type}

Report Title: ${variables.report_title}

Description of Report: ${variables.description_of_report}

Urgency: ${variables.urgency}

Requested Due Date: ${variables.requested_due_date}

${mail_script:approval_items_summary}

${sysapproval.description}

${mailto:mailto.approval}

${mailto:mailto.rejection}

Click here to view ${sysapproval.sys_class_name}:  ${sysapproval.URI}

 

The mail_script approval items are showing up as intended, but the variables from the requested item are not. I tried creating an email template and importing that but I achieved the same results. I attached some screenshots to help provide clarity. Any and all help is greatly appreciated. Thank you for your time!

From,

Chris

1 ACCEPTED SOLUTION

Also Can you replace setReqwuestID line with 

set.setRequestID(current.getValue('sysapproval'));

View solution in original post

11 REPLIES 11

Thx for the solution - For using it more cross request -  i use the isVisibleSummary value instead

 if(vs.get(i).getLabel() != '' && vs.get(i).isVisibleSummary()) {
           template.space(4);
           template.print('     ' +  vs.get(i).getLabel() + " = " + vs.get(i).getDisplayValue() + "<br />");  
        }

Kevin M1
Kilo Contributor

Hey Chris & DVP

 

Thank you so much for posting this this is pretty much exactly what I was looking for but I was curious what the workflow looks like for the RITM to stay in Requested  until approval or deny happens that it gets assigned to a specific group or closes out the ticket. I appreciate the assistance on this. 

 

Thank you for your time.