Link that allows users to download the files directly instead of opening them in a new tab

saketh poola
Tera Contributor

We have a requirement in a Record Producer form that includes a Select Box field. Based on the user's selection, a Rich Text Label should dynamically display a corresponding template—one template for a specific option, and a different template for another. Additionally, when the user clicks on any links within the Rich Text Label, the associated file should download directly rather than opening in a new browser tab.

How we can achieve this? 
I have tried with widget however it is working for only one template, if the form having multiple templates it won't work. - I am not looking for Widget as a solution.
Please help me!!

11 REPLIES 11

@saketh poola 

you want to open the file stored in sharepoint within widget?

I doubt if that is feasible.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Juhi Poddar
Kilo Patron

Hello @saketh poola 

There is a simple workaround to make the file download directly instead of opening in a new tab:

  • Convert the editable link into a downloadable format.
  • Instead of using the default editable file link, update the URL to use the export format. This forces the browser to trigger a download when the link is clicked.
  • Please refer the screenshot below

JuhiPoddar_0-1752679391694.png

  • You can use this updated URL in a Rich Text Label variable on your record producer.
  • Additionally, you can control the visibility of this Rich Text Label using a catalog client script or UI policy, based on your conditions.

Let me know if you’d like help implementing the visibility condition or dynamically generating the download link.

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You

Juhi Poddar

 

 

@Juhi Poddar  - It didn't work.

@saketh poola 

Please share some screenshot here also did you try converting the url to a downloadable link?

If you are facing issue converting the URL then a AI tool can convert it for you.

The same downloadable URL needs to be added in the instruction part of variable.

 

Thank You

Juhi Poddar

@Juhi Poddar - It didn't work.

Did you try converting the url to a downloadable link? - Yes

The same downloadable URL needs to be added in the instruction part of variable? - Yes

I have used 'Export format' method and I have tried with 'download=1' at the end the URL.

For Export format' method I am getting 404 error file not found.

For download=1, It is asking me to open the file instead of download. I am thinking I don't have required permissions to share point file to download.