Email script error
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago - last edited 4 weeks ago
Hi,
Created Email script for hyperlink to the compliance case workspace for the record.
it is showing "
Email script render error: email script [ Compliance_case ] does not exist" error
(function runMailScript(current, template, email, email_action, event) {
// var taskSysId = current.sys_id;
// var gr = new GlideRecord('sn_grc_case_mgmt_case_task');
// gr.get(taskSysId); // simpler way to fetch by sys_id
// if (gr.isValidRecord()) {
// var parentSysId = gr.getValue('parent');
// var taskNumber = gr.getValue('number');
// Get base URL from system properties
var baseURL = gs.getProperty('glide.servlet.uri') + gs.getProperty('glide.sys.servlet_path');
// Build workspace path - adjust as necessary for your environment
var workspacePath = 'now/risk/compliance/record/sn_grc_case_mgmt_case/' + current.parent;
// Full clickable URL to the parent record
var workspaceURL = baseURL + workspacePath;
// Create an HTML anchor tag with the task number as link text
var clickableLink = '<a href="' + workspaceURL + '" target="_blank">' + current.parent.number + '</a>';
// Print the clickable link into the email body
template.print(clickableLink);
template.print('Task record not found.');
})(current, template, email, email_action, event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
Hi @Arun_Manoj,
is Compliance_case in the same scope?
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
email script is in which scope?
what debugging did you do by adding gs.info() ?
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
4 weeks ago
Hi @Arun_Manoj ,
make sure the name of the email script is correct and you have added the correct name in the notification
example
the highlighted email script doesn't exist in my instance
when I preview the notification it throws the error you have mentioned
just check if you have used any additional spaces and remove them if required
Please mark my answer as helpful/correct if it resolves your query.
Regards,
Chaitanya