6860 views

How to add a Custom [Add Attachment] button | Service Catalog 

 

Description


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.

Solution


This can be accomplished with two simple steps:
  1. Create a UI Page with some basic jelly script.
    The script includes the button and the script that fires when the button is clicked.
  2. 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:

  1. Navigate to System UI > UI Page.
  2. Click New.
  3. Provide a Name such as Add_Attachment_UI.
  4. In Category, select General.
  5. 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>
    </j:jelly>
Add a UI page variable using the following steps:
  1. From your Catalog Item, add a New Variable.
  2. In Type, select UI Page.
  3. In UI Page, select Add_Attachment_UI (from process above).
  4. Set the rest of the fields as you normally would. 

 

Additional Information


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

 

Article Information

Last Updated:2018-03-30 16:22:43
Published:2018-03-30