how to add newly created CI link in the notification Workflow activity message

Selva Arun
Mega Sage
Mega Sage

Hi All, 
I have a requirement to add newly created CI link in the notification Workflow activity message, when I preview the email, I dont see the link. Can someone please help me, please, please?

Dear ${requested_for.name}

I hope this message finds you well. We wanted to inform you that ${request.number} request has been successfully processed, and a new application CI has been created.

LINK: https://instancenameservice-now.com/now/nav/ui/classic/params/target/cmdb_ci_appl_list.do%3Fsysparm_...

Best regards,
ServiceNow Team

 

my variable name is application_name

how to add {URI_REF} for the above link, I tried with the below script on the advanced tab, still no go:

${mail_script:FindtheApplicationLink.URI_REF}- used it in the message

var applicationName = current.variables.application_name;
var gr = new GlideRecord('cmdb_ci_appl');
gr.addQuery('name', applicationName);
gr.query();

while (gr.next()) {
var Applsysid = gr.sys_id;
var sysClass = gr.sys_class_name;

var url = 'https://instancenameservice-now.com/now/nav/ui/classic/' +
'params/target/' + sysClass + '.do?sys_id=' + Applsysid +
'&sysparm_record_target=cmdb_ci_appl' +
'&sysparm_record_row=1&sysparm_record_rows=31482' +
'&sysparm_record_list=ORDERBYname';

template.print('Generated URL: ' + url);

4 REPLIES 4

palanikumar
Giga Sage

Hi,

 

Is this the complete email script? curly brace '{' is not properly closed for the while loop.

Thank you,

Palani

Thank you,
Palani

Hi Palani,

 

Thank you so much, here is the complete code which I had written, its not working! Can you please help me ?

 

var applicationName = current.variables.application_name;
var gr = new GlideRecord('cmdb_ci_appl');
gr.addQuery('name', applicationName);
gr.query();

while (gr.next()) {
var Applsysid = gr.sys_id;
var sysClass = gr.sys_class_name;

var url = 'https://instancenameservice-now.com/now/nav/ui/classic/' +
'params/target/' + sysClass + '.do?sys_id=' + Applsysid +
'&sysparm_record_target=cmdb_ci_appl' +
'&sysparm_record_row=1&sysparm_record_rows=31482' +
'&sysparm_record_list=ORDERBYname';

template.print('Generated URL: ' + url);
}

I need to attach newly created CI link in the notification Workflow activity message, when I preview the email, I dont see the link. Can someone please help me, please, please?

Thank you 

Hi Palani,

 

Thank you so much, here is the complete code which I had written, it's not working! Can you please help me ?

 

var applicationName = current.variables.application_name;
var gr = new GlideRecord('cmdb_ci_appl');
gr.addQuery('name', applicationName);
gr.query();

while (gr.next()) {
var Applsysid = gr.sys_id;
var sysClass = gr.sys_class_name;

var url = 'https://instancenameservice-now.com/now/nav/ui/classic/' +
'params/target/' + sysClass + '.do?sys_id=' + Applsysid +
'&sysparm_record_target=cmdb_ci_appl' +
'&sysparm_record_row=1&sysparm_record_rows=31482' +
'&sysparm_record_list=ORDERBYname';

template.print('Generated URL: ' + url);
}

I need to attach newly created CI link in the notification Workflow activity message, when I preview the email, I dont see the link. Can someone please help me, please, please?

Thank you 

Here is the complete script:
var
applicationName = current.variables.application_name; var gr = new GlideRecord('cmdb_ci_appl'); gr.addQuery('name', applicationName); gr.query(); while (gr.next()) { var Applsysid = gr.sys_id; var sysClass = gr.sys_class_name; var url = 'https://instancenameservice-now.com/now/nav/ui/classic/' + 'params/target/' + sysClass + '.do?sys_id=' + Applsysid + '&sysparm_record_target=cmdb_ci_appl' + '&sysparm_record_row=1&sysparm_record_rows=31482' + '&sysparm_record_list=ORDERBYname'; template.print('Generated URL: ' + url); }

 

Please help me bro