Download file on catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Hello Team,
We have requirement that "Document" is a drop down variable on the service catalog if you select the 'yes' in that variable we need to show the document link type or name. If you click on that link document should be downloaded(Business has given the word doc) and user will fill the data and attach this doc in the attachment and submit the catalog can anyone suggest how to achieve this kindly help us in scripting or any other best salutation
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @Shabbir1 ,
Create the following three catalog variables:
- Select Box – Options: Yes / No
- Rich Text Label – Provide the Word document download link
- Attachment – Allow the user to upload the completed document
Create a Catalog UI Policy with the condition Document is yes. When true:
- Show the Rich Text Label.
- Show the Attachment variable.
- Make the Attachment variable mandatory.
When Document is no, hide the download link and Attachment variable and make the attachment non-mandatory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @Shabbir1
Step 1. Create the Variables
- Variable 1:
- Type: Select Box (Dropdown)
- Name: u_need_document
- Question: Do you need the document template?
- Choices: Add two choices: Yes and No.
- Variable 2:
- Type: Rich Text Label (Recommended) or HTML
- Name: u_document_download_link
- Label / Text: Use the HTML editor to format a clean link. //click on code view (<>) icon and add your code:
html
<a href="/sys_attachment.do?sys_id=<YOUR_COPIED_SYS_ID_HERE>" target="_blank" download>
Click here to download the required Word Document template
</a>
Step 2: Create a Catalog UI Policy
To control the visibility so the link only shows when the user selects 'Yes':
- On your Catalog Item, scroll down to the Catalog UI Policies related list and click New.
- Short Description: Show document link when 'Yes' is selected.
- Conditions: Set the condition to: [u_need_document] [is] [Yes].
- Click Submit
In the Catalog UI Policy Actions related list at the bottom, click New.
- Select your link variable (u_document_download_link).
- Set Visible to True.
- Set Mandatory and Read Only to Leave alone or False.
- Click Submit.
Step 3: Ensure Attachments are Enabled
- Open the main Catalog Item record.
- Ensure that the Hide Attachment checkbox is unchecked.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
