Email Script Linking to Parent Record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2023 06:07 PM
Hi guys!
This is the issue I'm getting, I hope someone can help me.
When I open an email notification in GMail on a browser where I'm impersonated as Project Manager, when I click on the email script take_me_to_the_benefit_plan it links me to the parent record, the Project.
This notification is fired by an event with this parameters:
if (project.getValue('u_related_it') == 'no' && project.getValue('u_financial_benefitsmonitoring') == true) {
benefit_plan_breakdown.u_approval = 'requested';
benefit_plan_breakdown.u_due_date_approval = true;
benefit_plan_breakdown.update();
gs.eventQueue("send.projectManager.email", project, project.getUniqueValue(), project.project_manager);
}
}
This notification must be sent to the Project Manager (this happens), but with record information of the benefit plan breakdown(Also this happens).
Here is the link code that I'm trying to use:
(function runMailScript(current, template, email, email_action, event) {
var link = current.getLink();
var backgroundColor = 'background-color: #cc1233;';
var border = 'border: 1px solid #4d0713;';
var color = 'color: #ffffff;';
var fontSize = 'font-size: 18px;';
var fontFamily = 'font-family: Helvetica, Arial, sans-serif;';
var textDecoration = 'text-decoration: none; border-radius: 3px;';
var webKitBorder = '-webkit-border-radius: 3px;';
var mozBorder = '-moz-border-radius: 3px;';
var display = 'display: inline-block;';
var padding = 'padding: 5px;';
template.print('<a href="' + link + '"');
template.print('style="' + backgroundColor + border + color + fontSize + fontFamily + textDecoration + webKitBorder + mozBorder + display + padding);
template.print('">');
template.print(gs.getMessage('Take me to the Benefit Plan Breakdown'));
template.print('</a>');
template.print('</font>');
template.print('<br><br>');
template.print('<p><font size="3" color="#808080" face="helvetica">');
template.print(gs.getMessage('Thank you.'));
template.print('</font></p>');
})(current, template, email, email_action, event);
The defect/issue I'm trying to solve is that I'm not getting the Benefit Plan Breakdown record that must be updated. I'm gettin the parent record.
Hope someone can help me, please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 08:01 AM
Did you print what came in the link?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 08:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 08:32 AM
Strange
Did you try printing current.sys_id and it's giving project sysId or Breakdown sysId?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2023 08:40 AM