How do I create an Excel report that includes the direct URL to the INC in SN

SRW
Kilo Contributor

I'm attempting to create and\ Incident report that will include a direct link URL to the INC in SN.  My reports are formatted for Excel.

Thank you in advance for any help you can provide.

Steve

1 ACCEPTED SOLUTION

Chaitanya Redd5
Tera Guru

Unfortunately we do not have the OOB feature to get a URL of record in Excel report.

To get the URL you need to create a new field on incident table. Type of the field will be url and it will be a calculated field.

You need to add below code set the URL of the current record.

(function calculatedFieldValue(current) {
	
	var url1=gs.getProperty('glide.servlet.uri')+"incident.do?sys_id="+current.sys_id;
	return url1;  // return the calculated value
	
})(current);

 

Please find the sample below:

 

find_real_file.png

 

Kindly mark my answer as Correct and helpful based on the impact.

Regards,

Chaitanya

View solution in original post

4 REPLIES 4

Jeff Currier
ServiceNow Employee
ServiceNow Employee

I think you need to create a calculated field on the incident table to be able to do this.  First, getting sys_id in a report isn't that easy.  If you had the sys_id, you would just prepend https://xxx.service-now.com/task.do?sys_id=<Sys id of Incident> and you would have what you want.  But since getting sys_id in a report is hard, you could pre-calculate this into a field and then just add that field to your report.

Calculated field would be something like https://xxxxx.service-now.com/task.do?sys_id=" + current.sys_id

Chaitanya Redd5
Tera Guru

Unfortunately we do not have the OOB feature to get a URL of record in Excel report.

To get the URL you need to create a new field on incident table. Type of the field will be url and it will be a calculated field.

You need to add below code set the URL of the current record.

(function calculatedFieldValue(current) {
	
	var url1=gs.getProperty('glide.servlet.uri')+"incident.do?sys_id="+current.sys_id;
	return url1;  // return the calculated value
	
})(current);

 

Please find the sample below:

 

find_real_file.png

 

Kindly mark my answer as Correct and helpful based on the impact.

Regards,

Chaitanya

is there a way to make this a bit cleaner? instead of displaying the URL, say we display the incident number instead?

SRW
Kilo Contributor

Thank you.