Open the catalog item in a new tab when "No' is selected

MR1
Tera Contributor

Hi All,

I need help with a particular catalog client script. It works correctly, but we would prefer to open the item in a new tab rather than the current one.

function onChange(control, oldValue, newValue, isLoading) {
   if(g_form.getValue('confirm') == "No")
// confirm is a yes/no type variable

  {

   top.window.location.href = ("https://dev788.service-now.com/sp?id=sc_cat_item&sys_id=c16222491b532510f761eb95604bc745");   
  // window.open( "https://dev788.service-now.com/sp?id=sc_cat_item&sys_id=c16222491b532510f761eb95604bc745", '_blank');  
}

   
}

 

Thanks

2 REPLIES 2

Sumanth16
Kilo Patron

Hi @MR1 ,

 

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

 

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

 

          return;

 

    }

 

  if (newValue=='No'){

 

    alert("You are being redirected to the SailPoint site.");

 

  window.open( 'http://www.google.com/', '_blank'); // <- This is what makes it open in a new window.

 

  }

 

}

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda

MR1
Tera Contributor

Unfortunately, the above script didn't work.

I got the alert pop-up but it didn't open the link in the new tab

 

Thanks