Add a URL link for a Multiple Choice Selection in a Catalog Item

chatsaurav19
Tera Contributor

Hi All,

 

How can I add a URL link for a selection of  say 'Yes' on a Catalog Choice variable? The URL link should get populated just below the message and upon clicking should help download an excel file

 

chatsaurav19_0-1696417312524.png

 

Regards,

Saurabh

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@chatsaurav19 

you want to show text along with URL inside it right?

You can do this

1) create a rich text label variable and it supports HTML tags etc so you can show the link along with text

2) use Catalog UI policy to show this rich text label variable when value is Yes

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

View solution in original post

7 REPLIES 7

Thank you @Ankur Bawiskar ! It worked!

 

Thank you @Samaksh Wani  for your help as well!

Hello @chatsaurav19 

 

As per community rules, you can mark multiple solution as Accept.

 

If you find my response as helpful, Plz mark my solution as Accept.

 

Regards,

Samaksh

Vishal Birajdar
Giga Sage

Hello @chatsaurav19 

 

1. To download upon clicking - First add your excel sheet in ServiceNow instance (sys_attachment) table. 

 

2. To create link add variable of type  "Rich text label" and put the order after your "request bulk" variable &

add link there as - 

/sys_attachment.do?sys_id=<sys_id of attachment we have created in first step>
 
VishalBirajdar_0-1696421096943.png

 

Click on the link icon and add above link there :

VishalBirajdar_1-1696421170252.png

 

3. You want to display it on some condition - so you can write onChange client script on your first variable  (request bulk)

 

//use your variable backend name wherever necessary 

 

function onChange(control, oldValue, newValue, isLoading) {
 
  if(newValue == 'Yes'){
	g_form.showFieldMsg('request',"Your message",'info');
	g_form.setVisible('link',true);
  }else {
	g_form.setVisible('link',false);
  }
   
}

 

 

 Output : 

 

If - Yes

VishalBirajdar_2-1696421374566.png

 

If - No

 

VishalBirajdar_3-1696421411052.png

 

 

 

 

 

 

Vishal Birajdar
ServiceNow Developer

I know one thing, and that is that I know nothing.
- Socrates