how do I change the target of the Requests menu in the portal

Tony V
Tera Guru

My customer wants the Requests menu in the portal header to point to RITMs instead of REQs. I have made the necessary changes to display the requested data (I changed the gliderecord table and commented out the section that counts related RITMs) but when I click the menu and then click an RITM on the list I am taken to the request page. It reports Request not found because of course there is no REQ that has a sys_id of the RITM I clicked on.

I can't see to find where the code is that changes the target. 

1 ACCEPTED SOLUTION

Tony V
Tera Guru

I was able to get some help from a colleague and here is what they pointed out. In the end the solution was to change the line:

a.type = 'request';

to 

a.type = 'record';

This line reference the Angular ng-template under the Header Menu widget. So if you navigate to Service Portal> Widgets > open "Header Menu" > Angular ng-template related list. The click on spDropdownTreeTemplate you will see that it contains code for handling several different record types. By switching the line above to 'record' it now reference the section of the template that I need and the link now opens the ticket page rather than the request page.

Thanks anyway for the help.

View solution in original post

8 REPLIES 8

Mike Patel
Tera Sage

go to sp_instance_menu.list and make sure you have correct page selected for your header menu.

or search for you header menu directly on sp_rectangle_menu_item.list and make sure page is correct.

This menu item is a scripted list (it is OOB) so I don't think the page field applies.

ok than you need to script it something like (below for approval) you will have to change id= to your page

var link = {};
link.title = gs.getMessage('View all approvals');
link.type = 'link';
link.href = '?id=approvals';
link.items = [];
t.items.push(link);

Sorry maybe I am being dense (likely) but I don't see how to implement this. Below is the section of the item I am working with. 

I tried adding the href link but that made no difference

I tried changing a.type = 'request'; to a.type = 'link'; but whatever I put in there breaks the list (the items are on the menu and clickable but have no content, the are blank lines

The Link section at the end appear to be for the "view all requests" link only

 

)

var z = new GlideRecord('sc_req_item');


z.addActiveQuery();
z.addQuery('u_task_for', gs.getUserID());
z.orderByDesc('sys_updated_on');
z.setLimit(max);
z.query();
while (z.next()) {
  if (!z.canRead())
    continue;
  
  
  var a = {};
  $sp.getRecordValues(a, z, 'sys_id,number,sys_updated_on');
  ritm.getDisplayValue("short_description");
  a.short_description = z.cat_item.getDisplayValue()

  
  a.__table = z.getTableName();
  a.type = 'request';
  a.href = '?id=ticket';   //< added this line
  a.sortOrder = z.sys_updated_on.getGlideObject().getNumericValue();
  t.items.push(a);
}

t.items.sort(function(a, b) {
  return b.sortOrder - a.sortOrder;
});
t.items = t.items.slice(0, max); // only want first 30
t.count = t.items.length;

var link = {title: gs.getMessage('View all requests'), type: 'link', href: '?id=requests', items: []};
t.items.unshift(link); // put 'View all requests' first