Any way to dynamically populate the sys_id of a catalog item in email notifications

matrat5114
Tera Contributor

Hello SNOW Community,

 

Currently the company I work for is switching from Service Portal to Employee Service Center and I'm one of the lucky people that has to go through our 700+ notifications and update the branding, links etc.

None of these notifications have been templated so while I'm here I'm also templating and making everything more dynamic where I can so that next time, we have to update everything we only have to do it in a few places, not 700+.

 

Which brings me to my question, does anyone know of an easy way to dynamically populate a sys_id of a catalog item?

Much like how current.getTableName() works?

 

This is the best I could come up with in an email script:

 

 

 

(function runMailScript(/* GlideRecord */ current, /* TemplatePrinter */ template,
          /* Optional EmailOutbound */ email, /* Optional GlideRecord */ email_action,
          /* Optional GlideRecord */ event) {
	var cat_item = "sc_cat_item";
	var url = gs.getProperty('glide.servlet.uri');
	var escplatform1 = gs.getProperty('esc.portal.url');

    template.print(url+escplatform1+cat_item+"&sys_id="); 
	//To use add the sys_id of the cat item you wish to link to in your email notification or email layout.
	
})(current, template, email, email_action, event);

 

 

Which works fine but it requires a separate layout or notification for each different catalog item you want to link to, which annoys me.

 

The current notifications I'm working on are on the Business Applications table which always have to be approved via a catalog item, which will then link those RITM's in a related list to that Business Application record which I would be able to dot walk into in my email script to then link them to the same item, but that will only work for these 10 notifications so not really worth the effort.

 

Other thing I was thinking was maybe using a decisions table and then scripting something around that, but I'm not sure it's worth the effort and just another thing to maintain and document for very little gain.

 

Not so much looking for a solution just a discussion on people's thoughts on how one could achieve this with the least amount of work.

 

Thanks in advance! 

0 REPLIES 0