Open a link in new tab

Haribabu1
Tera Contributor

Hello,

 

When I select the checkbox variable of a record producer in the service portal, it needs to be an open link in a separate tab.

note: Can we achieve this without DOM?

 

Thanks in advance

 

1 ACCEPTED SOLUTION

@Haribabu1 

use this onChange catalog client script on that variable

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading) {
		return;
	}

	var url = '/sp?id=sc_cat_item&sys_id=recordProducerSysId'; // give here your portal name and the record producer sysId
	if (newValue == "your value to compare") {
		try{
			if(window != null)
				g_navigation.open(url, '_blank');
		}
		catch(ex){
			top.window.open(url,"_blank");
		}
	}
}

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

6 REPLIES 6

Ankur Bawiskar
Tera Patron
Tera Patron

@Haribabu1 

what needs to open in new tab?

which link? how are you showing the link?

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hello Ankur,

 

It need to be open a separate record producer in the portal

 

Thanks

@Haribabu1 

use this onChange catalog client script on that variable

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
	if (isLoading) {
		return;
	}

	var url = '/sp?id=sc_cat_item&sys_id=recordProducerSysId'; // give here your portal name and the record producer sysId
	if (newValue == "your value to compare") {
		try{
			if(window != null)
				g_navigation.open(url, '_blank');
		}
		catch(ex){
			top.window.open(url,"_blank");
		}
	}
}

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

Hello Ankur,

 

Thanks for the quick response.

 

I have a question. The provided code is under DOM, right?