How to place the attachment links in record producer table's description field?

Rajini2
Mega Sage

When the record producer is submitted, I need the attachment links to show up in my description field.

Here is the code. It works when I hardcode the sysid and test it in background script. But does not work within the record producer. Any suggestions?

var attachmentLinks = "";
var grAttach = new GlideRecord('sys_attachment');
grAttach.addQuery('table_sys_id', current.getUniqueValue());
grAttach.addQuery('table_name', current.getTableName());
grAttach.query();
while (grAttach.next()) {
	gs.log("grAttach.sys_id-------------" + grAttach.sys_id);
	attachmentLinks += gs.getProperty('glide.servlet.uri') + "sys_attachment.do?sys_id=" + grAttach.sys_id +"\n";
}
current.description = attachmentLinks;

 

9 REPLIES 9

I tried this with an incident RP I created in my (Xanadu) PDI.  I used Service Portal, attached with the paper clip icon, without encryption, and the description was updated as expected.  Is your RP in a scoped app?

All in Global scope.

Is what you shared the entire record producer Script, or are you doing other things before or after this?

I just shared a portion of it. 

 

This info will be integrated into another tool.  So, we changed the requirement to address this in a different way in my flow.

 

Thanks for troubleshooting with me.

Sumanth16
Kilo Patron

Hi @Rajini2 ,

 

Please refer below thread:

https://www.servicenow.com/community/itsm-forum/want-to-provide-excel-template-on-catalog-item/m-p/6...

 

Please hit like and mark my response as correct if that helps.


Regards,

Sumanth Meda