How to show a downloadable xl file link conditionally when user selects one of choice in a dropdown
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
How to show a downloadable xl file link conditionally when user selects one of the choice in a dropdown field in service portal?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
this is possible with this approach
1) store that excel on your catalog item record, grab the sys_attachment sysId for that file from sys_attachment table
2) then use onChange catalog client script on that select box
a) use g_form.addInfoMessage() and show the link to download the file
Something like this
Give correct sysId from sys_attachment, correct choice values to compare
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var link1 = '<a href="/sys_attachment.do?sys_id=sysId1" target="_blank">Click here to download Template 1</a>';
if (newValue == 'choiceValue1') {
// Add the info message with the link
g_form.addInfoMessage(link1);
} else {
g_form.clearMessages();
}
}
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
