Customize Record Producer Attachment Button on CMS Page

davidhale
Kilo Explorer

There a number of articles and discussions on how to customize attachment buttons but not how we want to change it.

What we are trying to do is:

  1. Limit the number of attachments that can be selected to 1 (Basically we are looking to remove the "Add Another Attachment" button)
  2. Add a Field to selected the file being loaded (Reference field to custom table with list of possible files to load)

From what I can see is the content of the attachment popup below is controlled from 2 sources. Content below the "Add Another Attachment" button is a UI page which can be modified to add a selection field. The "Add Another Attachment" button and above is from "saveCatAttachment(gel('sysparm_item_guid').value, 'u_ar_package')" which I'm not sure of the source.

Any assistance would be great.

Thanks Dave

find_real_file.png

2 REPLIES 2

Manjul Katare
ServiceNow Employee
ServiceNow Employee

Hi David,



I'm not sure if there is anything available to limit number of attachment, you can tweak things like hide "Add Another Attachment" but you would still be able to attach more attachment. Also people do use drag n drop feature on the forms & record producers.



There is another very similar open thread with no solution available: Limit on number of attachments to a ticket



Thanks,


Manjul


Manjul,



Thanks for the reply......



The below code is in the macro used for adding the attachment. "saveCatAttachment" is executed to load the popup. What is this? I don't find it as a UI Page. Is it something we can copy and modify?



<button>


<a id="header_attachment_list_link" href='#' class="attachment" onclick="saveCatAttachment(gel('sysparm_item_guid').value, 'u_ar_package'); return false;">


  <img title="Attachments..." src="images/icons/attachment.gifx" height="16" border="0" width="16" /> $[sp]


                ${gs.getMessage('Click to Here to Upload Package')} </a>


</button>