I am trying to create a pop-up when a certain action is selected on a form and have a link on the popup for the user to go to an external web address. I have the pop-up working fine but need to know how to create a link in the code below or create a

kevinmalone
Kilo Explorer

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

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

          return;

    }

  var eq = g_form.getValue('ref_12_equipment');

  if (eq=='Monitor')

  {

  alert('Non-standard and secondary monitors are available on the iProcurement page:https://oamprd.betx.com:4445/oam/server/obrareq.cgi?encquery%3DeeqHwTbSyEq6Uk7dMZZDLzqg31iK4Gong5NDH...

Any idea on how to use the   iProcurement word as a link ?

3 REPLIES 3

TrevorK
Kilo Sage

One work around would be to create a pop-up - then you just set the onClick for the button to go to your URL. So your message would something like "Click the OK button to view more details on non-standard and secondary monitors on the iProcurement page or click Cancel to go back to the previous page". Something like "window.confirm" (you could google it to find some examples) I think would work.



You could also do this through a UI Page where you direct the user based on the button they click. With the UI Page you can even get "fancy" and use pictures for the link. So they can click on an image that says "iProcurement" and "Return". We use this sort of thing when asking the user for "yes" or "no".


find_real_file.png


Here is some documentation on using a custom popup window from ServiceNow: Displaying a Custom Dialog - ServiceNow Wiki




I could be wrong as I am not a Javascript master, but as I far as I know the Alert box is just for read-only text. There are other ways I know of involving jQuery and that where you can do this but that might be a bit too complicated for your needs. I would focus more on using their Custom Dialog above, and if that doesn't meet your needs and you are feeling adventurous you can go to the jQuery and other more advanced stuff.


rob_blakey
Tera Expert

Hi Kevin,



Have you tried something like:



g_form.addInfoMessage("<a href='"+location.href+"'>"+location.href+"</a>");


HV1
Mega Guru

Create a UI page with your HTML body and links.   Call this UI page using GlideDialogWindow


Ref: Displaying a Custom Dialog - ServiceNow Wiki



Regards,


Hardik Vora