The Zurich release has arrived! Interested in new features and functionalities? Click here for more

UI Action to open a catalogue item within current record or new tab

Jacob23
Mega Guru

Hi,

I am trying trying to create a related link within a change record that will either open a catalog item within the change record, or open a new tab direct to the service portal for the user to submit the request. Preference on having this open within the form and the UI action being a related link.

Any assistance will be appreciated! I am assuming a script will need to be created using the g_navigation.open command

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

make the UI action as Client side

function openLink(){

	// for portal
	var portalUrl = '/sp?id=sc_cat_item&sys_id=' + 'catItemSysId';
	
	// for native
	var nativeUrl = '/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=' + 'catItemSysId'; //
	
	g_navigation.open(portalUrl, '_blank'); // new tab use _self for same tab

}

find_real_file.png

Regards
Ankur

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

View solution in original post

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

make the UI action as Client side

function openLink(){

	// for portal
	var portalUrl = '/sp?id=sc_cat_item&sys_id=' + 'catItemSysId';
	
	// for native
	var nativeUrl = '/com.glideapp.servicecatalog_cat_item_view.do?v=1&sysparm_id=' + 'catItemSysId'; //
	
	g_navigation.open(portalUrl, '_blank'); // new tab use _self for same tab

}

find_real_file.png

Regards
Ankur

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

Thank you Ankar, this has worked!

Hey,

 

How do you create this using a Form Button? Not a link.

Here's my code - UI Action button on Interaction table

 

} else if {current.category == "Complaint") {

var portalUrl = '/sp?id=sc_cat_item&sys_id=' + '47c185ab1b432d50b49374ce0a4bcb67';
g_navigation.open(portalUrl, '_blank');