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.

Scripted List in Menu Items is not showing on the portal

psk2024
Tera Contributor

Hi Community,

I have created a Scripted List type Menu Item in ServiceNow, intended to allow users to download an attachment directly from the menu. Below is the script I used, but the download button is not appearing in the menu.

 

var t = data;
t.items = [];

var userSysId = gs.getUser().getID();
var attachmentURL;
var attachmentGr = new GlideRecord('sys_attachment');
attachmentGr.addQuery('table_sys_id', userSysId);
attachmentGr.addQuery('table_name', 'sys_user'); 
attachmentGr.query();
if (attachmentGr.next()) {
var attachmentURL = '/sys_attachment.do?sys_id=' + attachmentGr.sys_id;
var link = {};
link.title = 'Download ID card';
link.type = 'link';
link.href = '/sys_attachment.do?sys_id=' + attachmentGr.sys_id;
t.items.push(link);
}

 

I've verified the script logic and ensured the attachment exists, but the button still doesn't show up. Is there something I'm missing in the script, or is there another configuration step I need to follow?

Any help would be greatly appreciated!

Thank you.

 

 

 

0 REPLIES 0