What does $sp.getMenuItems($sp.getValue("sys_id")) return?

GLewis5
Tera Guru

What does $sp.getValue("sys_id") return?  The sys_id of what?

From what table does  $sp.getMenuItems  get its data?

1 ACCEPTED SOLUTION

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @GLewis5 ,

It return the sys_id from the sp_instance_menu table.

Please find the below link for more info

https://sn.jace.pro/classes/glidespscriptable/

 

Thank you,

Omkar

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

View solution in original post

2 REPLIES 2

Omkar Kumbhar
Mega Sage
Mega Sage

Hello @GLewis5 ,

It return the sys_id from the sp_instance_menu table.

Please find the below link for more info

https://sn.jace.pro/classes/glidespscriptable/

 

Thank you,

Omkar

If I was able to help you with your case, please click the Thumb Icon and mark as Correct.

Paul Hegel
Mega Guru

@GLewis5,

I had a similar question but I was needing to know what the structure of the menu looks, but $sp is not available in Xplore script utility.  I used the reference above to display what is returned from the $sp.getMenuItems(menu_id):

var sp = new GlideSPScriptable();
var menu_id = '4ebb93d81b79c690a95611f8bc4bcb2d'; // sys_id of the menu sp_instance_menu

var items = sp.getMenuItems(menu_id);
items;

You can capture the sys_id from the menu in the application or you can use this code to view all of your menu instances:

var gr = new GlideRecord('sp_instance_menu');
gr.query();
var menus = [];
while (gr.next()){
  var menu  = {menu_id: gr.getValue('sys_id'), menu_display: gr.getDisplayValue()};
  menus.push(menu)
}
menus;

Hope this is helpful,

Paul