Script behind attachment ui page

xiaix
Tera Guru

I'm a bit baffled as to where the code-behind is for the attachment ui page when initiated.

I found the Script Include, "AttachmentAjax", that handles the actual updating and processing of an attachment.   I've scoured through and tested each function of the Client Script section of the attachment UI page, but I just don't see where the call is to first query the sys_attachment table.

Visual Example:

I have a link on a UI page:

find_real_file.png

The link calls this function:

find_real_file.png

The "attachment" UI Page came built in with ServiceNow (Eureka).   Like I've mentioned though, I've gone over the attachment ui page line by line and I don't see any ajax calls or any functions that, upon loading, go and get current attachments, but it does.   Where is this code?

1 ACCEPTED SOLUTION

coryseering
ServiceNow Employee
ServiceNow Employee

Hi David,



Far down in the code you will find a line like this:


<g2:attachment_list sys_id="${jvar_target_sys_id}" table="${jvar_target_table}">



That calls an extension to Jelly which takes as input the sys_id and table of the record that you're on when you open the dialog. It calls   new SysAttachment();


sa.getAttachments(table, sys_id);



That gets Attachments for all of the records for that given table, and puts it into a variable that is used in the next line of that page:


<g2:for_each_record file_variable="sys_attachment" var="attachment">



This loops over all of those attachments and outputs the HTML you see below *that*- an input button, and then a UI Macro (attachment_entry).



I hope that's helpful


Cory


View solution in original post

10 REPLIES 10

Hi Arnab, 

 

Can you please let me know the script for UI page to parse excel to Catalog item form??

 

Actually i have same requirement, to parse excel from UI page and user will attach excel on catalog item form and  then On submission of catalog item form the record present in excel will be trigger to Datasource of "cmdb_ci_server". And will update the records.

 

Many Thanks,

Anupam.