How to add a Custom [Add Attachment] button | Service Catalog
When submitting a Service Request, the requester can add attachments using the icon located on the form header. That icon is not always very noticeable. Customers sometimes ask for an [Add Attachment] button to be placed within the Service Catalog to make adding attachments easier for the requester.
This can be accomplished with two simple steps:
- Create a UI Page with some basic jelly script.
The script includes the button and the script that fires when the button is clicked.
- Add a UI Page Variable to your Catalog Item that references the UI Page.
Steps to implement
Create a UI page using the following steps:
- Navigate to System UI > UI Page.
- Click New.
- Provide a Name such as Add_Attachment_UI.
- In Category, select General.
- In HTML, copy the paste the following HTML (note that you can change the label of the button by changing the highlighted section):
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<button type="button" onclick="saveCatAttachment(gel('sysparm_item_guid').value, 'sc_cart_item')">Add Attachment</button>
- From your Catalog Item, add a New Variable.
- In Type, select UI Page.
- In UI Page, select Add_Attachment_UI (from process above).
- Set the rest of the fields as you normally would.
The following button appears below on your Catalog Item:
When you click the button, the standard Attachment Browser is displayed:
The rest of the features are standard, base system functionality.
NOTE: This will not work from Geneva. From Istanbul we support this OOB