- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
Hello people
I have a requirement to show 'Downloadable' template file under a field on a catalog form. The catch is, this file will change based on the selection or combination of selections made on two fields of type 'SelectBox'.
Variable1 has 4 choices, Variable2 has1 choices.
Example Scenario:
Variable1 -> Option A selected
Variable2 -> Option 1 selected.
So, on basis of this, respective file template should be shown under 'Upload Template'(Type is attachment). User can click on the template and get the template downloaded.
Unser Annotation of 'Upload Template' we have 'Insert/edit Link' but it remains static. We need the link to change.
I tried few ways but nothing seems to work as required.
Any idea on how to crack this? Would be helpful! 🙂
Appreciate your time and effort.
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have worked on this scenario in the past, you can implement dynamic attachments in your catalog item by using a Rich Text / HTML variable (or custom widget variable) whose content (an <a> download link pointing to a sys_attachment.do?sys_id=…) gets set via a client script triggered by changes in your select boxes, with the sys_id value returned from a GlideAjax/Script Include that queries the sys_attachment table based on those field values......
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I'm not following why you have an attachment type variable if a file will not be attached to the request - you could try using a label. In any case, I would create a variable for each file template. Use an onChange Catalog Client script when variable 1 changes to determine which variable is displayed. Once that's working, copy it to do the same when variable 2 changes - unless this variable will always only have 1 choice, then it's not really needed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I agree with what @Brad Bowman to use different Rich Text Label variable which shows the different file
then based on change of variable value show/hide the variable
OR
You can use a variable of type Custom and include Widget to it.
widget will detect onChange event of variable and based on choices will show that HTML element with the link
see this links for reference help
ServiceNow Code Snippets: Catalog Items and the Portal Widget Data Object
How to pass a value from a Widget to a Catalog item variable
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Did you get a chance to check my above solution?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I have worked on this scenario in the past, you can implement dynamic attachments in your catalog item by using a Rich Text / HTML variable (or custom widget variable) whose content (an <a> download link pointing to a sys_attachment.do?sys_id=…) gets set via a client script triggered by changes in your select boxes, with the sys_id value returned from a GlideAjax/Script Include that queries the sys_attachment table based on those field values......
If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/
