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.

Link to portal with email script

Odile Luhembwe
Tera Contributor

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.

 

1 REPLY 1

Sai Shravan
Mega Sage

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

Regards,
Shravan
Please mark this as helpful and correct answer, if this helps you