- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 07:02 PM
Hi Team ,
We have an requirement that ,
In the catalog for we have line manager ,
Once Line manager approves , we need to send email to xyz@gmail.com , After that two parallel SC task has to be triggered .
This is catalog form
The challenge i am facing in notification
Requirment is
Body of the notification
Subject: <Short description>
"A lost or stolen device has been reported by" <Requested For>
The device was lost or stolen on <Date item was Lost/Stolen>
[Blank Line]
"Description:"
<Description>
How should i bring catalog variables in the notification , in the right hand side i can't find catalog variables .
can anyone please help me here , on this requirements
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 09:20 PM
Hi @nameisnani ,
You have to utilize notification email scripts to pull out the variables of the catalog item.
Create new record in notification email script as below:
Then call the above script in notification as below:
${mail_script:scriptName}
Mark this as Helpful / Accept the Solution if this clears your issue
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 11:01 PM
you are using the wrong syntax to get variable value
the correct syntax is current.variables.variableName
update as this
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var requester = current.variables.requested_for.getDisplayValue();
var date = current.variables.date_item_was_lost_stolen.getDisplayValue();
email.setSubject(current.variables.short_description_1);
template.print("<p>A lost or stolen device has been reported by " + requester);
template.print("<p>The device was lost or stolen on " + date);
template.print("<br />");
template.print("Description:" + current.variables.description_1);
})(current, template, email, email_action, event);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2024 11:03 PM
You are missing the variables before the varible, have a look at updated code
(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */
email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */
event) {
var requester = current.requested_for.getDisplayValue();
var date = current.variables.date_item_was_lost_stolen.getDisplayValue();
email.setSubject(current.variables.short_description_1);
template.print("<p>A lost or stolen device has been reported by " + requester);
template.print("<p>The device was lost or stolen on " + date);
template.print("<br />");
template.print("Description:" + current.variables.description_1);
})(current, template, email, email_action, event);
Mark this as Helpful / Accept the Solution if this clears your issue
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 12:59 AM
I have checked in email logs , there is no email sent
can you please tell what was issue here .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 01:10 AM
In the sc_req_item table check both conditions that you have mentioned.
Secondly, Is there anyone defined in the 'Who will receive'?
Mark this as Helpful / Accept the Solution if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2024 01:36 AM