Murthy Ch
Giga Sage

Hi there,

Created a simple Try it [Portal] Button for catalogs and order guides.

When ever we are working on the catalog or order guide we usually go to the portal page and open the item but by using this button we can open the items from the native UI.

So, the functionality of this button is when we click on it, it will open the catalog or order guide in service portal.

Code:

Name: Try it[Portal]

Table: sc_cat_item

Onclick : onportal()

Condition: 

current.active==true;

 Code:

function onportal() {
var url = '';
var tablename = g_form.getTableName();
var sysId = g_form.getUniqueValue();
var ins = 'https://dev12345.service-now.com/';  // here change your instance number accordingly
if (tablename == 'sc_cat_item' || tablename == 'sc_cat_item_guide' || tablename == 'sc_cat_item_producer') {
if (tablename == 'sc_cat_item')
url = ins + "sp?id=sc_cat_item&sys_id=" + sysId;       //for Catalog
else if (tablename == 'sc_cat_item_guide')
url = ins + "sp?id=sc_cat_item_guide&sys_id=" + sysId; //for Order guide
else
url = ins + "sp?id=sc_cat_item&sys_id=" + sysId;       //for Record producer
top.window.open(url); // (OR)  g_navigation.openPopup(url) we can use both if we want to open in new or next tab.
top.window.location=url;     //Use this if you want to open in same tab
}
}

Screenshots:

find_real_file.png

find_real_file.png

If this article helps you, Please mark it as helpful or bookmark it!...

 

Cheers,

Murthy

Comments
SAI VENKATESH
Tera Sage
Tera Sage

very useful content 

 

Thanks for the article 

 

thanks and regards

 

Sure Sai venkatesh

Community Alums
Not applicable

Very Usefull article, Thanks for the work.

Gaurav Shirsat
Mega Sage

Nice One.. and even we can make it dynamic by adding current.cat_item.sys_id

Taha El alami
Kilo Sage
Kilo Sage

Nice one interesting ,Very usefull article.

Akanksha Gupta2
Mega Guru

Nice Article . 

Thanks 

Murthy Ch
Giga Sage

Glad to help.

 

Thanks

Akanksha Gupta2
Mega Guru

Hi Gaurav , 

can you pls explain more on this , like how can we make this dynamic .

Regards,

Akanksha

Murthy Ch
Giga Sage

Thank you:)

Version history
Last update:
‎05-08-2021 02:52 AM
Updated by: