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.

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
Kilo 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?