Could I make a Question Choice a hyperlink?

JLeong
Mega Sage

I need my selection list to be hyperlinks. I would like to link it to another form, is this possible?

Thanks in advance.

1 ACCEPTED SOLUTION

Raju Koyagura
Tera Guru

I am not sure about providing hyperlinks in choice list but there is an alternate workaround for this applying onChange script based on the choice values.


Script:


function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue == '') {


          return;


    }




    if(newValue=="Your Choice Value 1")


    window.location.href='problem.do';


if(newValue=="Your Choice Value 2")


    window.location.href='incident.do';


.............................


}


View solution in original post

13 REPLIES 13

Raju Koyagura
Tera Guru

I am not sure about providing hyperlinks in choice list but there is an alternate workaround for this applying onChange script based on the choice values.


Script:


function onChange(control, oldValue, newValue, isLoading, isTemplate) {


    if (isLoading || newValue == '') {


          return;


    }




    if(newValue=="Your Choice Value 1")


    window.location.href='problem.do';


if(newValue=="Your Choice Value 2")


    window.location.href='incident.do';


.............................


}


Hi Raju,


Thanks for responding. However its not working. I think I need to open it on a new tab. Can you provide the code for that?



This is what I have:



function onChange(control, oldValue, newValue, isLoading) {


  if (isLoading || newValue == '') {


  return;


  }



  if(newValue=="Corporate FTP"){


  alert('new value');



  window.location.href="https://rrd.service-now.com/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=b74b3622bd82...";



  }


}


Raju Koyagura
Tera Guru

What do you mean by not working? Can you provide the error?


I tried in my dev instance and it is working and redirecting to login page.


No error message, it just not doing anything.



For now, I only have 2 options, if I click on Corporate FTP, it doesn't launch the link. This happens all the time for my other links within ServiceNow, I had to open them in a new tab by using <a target="_blank" href="URL". But I am not sure how to do that using your script.



find_real_file.png



Thanks!