Link to portal with email script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 02:57 AM
Hi
We have extended our Idea table and have a new table with the module: General
I am trying to update the email script so that the link will point to the new Idea Portal but im failing at it, as i also have no knowledge of scripting.
1. This is the script we used for the old portal :
(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
/* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
/* Optional GlideRecord */ event) {
var instance_name = gs.getProperty("instance_name");
var link = "https://"+instance_name+".service-now.com"+"/idea/?id=view_idea&sysparm_idea_id="+current.sys_id+"&sysparm_idea_table=idea";
template.print('<a href="'+link+'">'+"Idéportalen"+"</a>");
})(current, template, email, email_action, event);
2. The question is, what must i change in the script to be able for the link to point to the new extended table.
Any help will be appreciated.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2023 07:10 AM
Hi @Odile Luhembwe ,
Assuming that the name of your new extended table is "x_idea", the updated script would look like this:
(function runMailScript(/* GlideRecord / current, / TemplatePrinter / template,
/ Optional EmailOutbound / email, / Optional GlideRecord / email_action,
/ Optional GlideRecord */ event) {
var instance_name = gs.getProperty("instance_name");
var link = "https://"+instance_name+".service-now.com"+"/x_idea.do?id=view_idea&sysparm_idea_id="+current.sys_id+"&sysparm_idea_table=x_idea";
template.print('<a href="'+link+'">'+"Idéportalen"+"</a>");
})(current, template, email, email_action, event);
Note that the only change made is to replace the references to the "idea" table with references to the "x_idea" table, both in the URL and the sysparm_idea_table parameter.
Regards,
Shravan
If my answer solved your issue, please mark my answer as Correct & Helpful
Shravan
Please mark this as helpful and correct answer, if this helps you