Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

How to get attachment count from interaction to service portal request form using client script

rahul16
Giga Guru

I want to get total number of attachments in interaction to request form using catalog  client script.

We are creating request from interactions.

I see the table sys_attachment and table_name=interaction^table_sys_id=[Interaction record sys_id]

We get total number of attachments.

But is this the only way or is there any other way to get the attachments count.

rahul16_0-1667283566755.png

I see the manage attachments have total number of attachments  can i use this value directly if yes how?

2 REPLIES 2

Saiganeshraja
Mega Sage

 

Call the script include in client script using glide ajax



GetAttcahmentCount : function(ID){
var att = new GlideRecord('sys_attachment');
att.addQuery('table_sys_id', ID);
att.query();
return  att.getRowCount();
};

Mark correct and helpful

 

How can i use this in catalog client script?