Attachment link on a variable on catalog item

DPrasna
Tera Contributor

Hi All,

 

I have a requirement to have an attachment link attached to a variable from which an attachment could be downloaded.

For example:

 

Please click here to download.

When click here is selected it should download an attachment for the user.

How to achieve the same.

Looking forward for ideas/ suggestion / solution.

 

TIA

@Ankur Bawiskar @Allen Andreas @Prince Arora @Ratnakar7 

7 REPLIES 7

Ratnakar7
Mega Sage
Mega Sage

Hi @DPrasna ,

 

You can create catalog variable with Type as "Custom", then create and attach new widget to this variable, like below:

 

-> Create new Widget 

Ratnakar7_1-1680608335720.png

->Map newly created widget to variable

Ratnakar7_0-1680608214775.png

-> Output:

 

Ratnakar7_2-1680608435389.png

 

If my response was helpful in resolving the issue, please consider accepting it as a solution by clicking on the Accept solution button and giving it a thumbs up 👍. This will benefit others who may have a similar question in the future.

 

Thank you!

Ratnakar

 

Sandeep Rajput
Tera Patron
Tera Patron

Use an HTML variable on your Catalog Item/Record Producer.

HtmlVariable.png

 

 

 

If the link is a static one you can directly set it on the variable itself otherwise if the link is dynamic then make a GlideAjax call inside your OnLoad client script, get the value from backend and set the value of HTML field 

 

g_form.serValue('html_description', '<a href="https://www.w3schools.com">Visit W3Schools.com!</a>
>');

 Also, in your onLoad client script make sure to set the html variable as readOnly. This will make the variable non editable and the user can only interact with the link and will not be able to change contents of it.

 

Hope this helps.

 

Source:  https://docs.servicenow.com/bundle/tokyo-servicenow-platform/page/product/service-catalog-management...

Ankur Bawiskar
Tera Patron
Tera Patron

@DPrasna 

you can add that file to catalog item

then you can use Rich text label variable and include link to sys_attachment so that user sees the link.

It will work in both native + portal

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

Hi Ankur, could you please let me know how to add the link to the rich text label?