- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-01-2023 07:54 AM - edited 06-06-2023 05:39 AM
Hi All,
I have a requirement to create a link in ritm form to download a file. When the user clicks on the link, it should download a file, and the form should stay on the same page.
For this, I created a UI action for the ritm table with the below code.
onclick -confirmDownload()
script:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2023 02:12 AM
your UI action should be client side and update script as this
No need to use action object
function confirmDownload() {
var URL = '/sys_attachment.do?sys_id=aec12b1b970321100408bde3f153affb';
var down = confirm("Do you want to download the file?");
if (down == true)
g_navigation.open(URL, '_blank');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 07:48 AM
are you saying on click of that Button the fields/variable data should be pushed to excel/csv file and that file should get downloaded?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 08:05 AM - edited 06-05-2023 09:14 AM
Exactly Ankur,
Can you help me on this requirement, as i don't have idea how to do this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-05-2023 08:11 PM
you need to use custom script for this
check this link and enhance further
Generate csv file with the catalog variables and attaching to RITM record
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 02:08 AM
Ok ankur,
Let me try the script. Can i use the same script on ui action?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-06-2023 03:03 AM - edited 06-06-2023 05:03 AM
tried with business rule, its working as per your script in global application.
Here I need this functionality in ui action. where as I have some specific fields to get the values from the form. upon clicks on ui action excel should downloaded with relevant information
UI action should works on scoped application.