Portal View - Request Item not visible under the Request Ticket

vidhukeshvimal
Kilo Contributor

Hello All,

Need urgent help not sure where to look at this issue - When an user submits a Request under Open request when they click on it they are unable to see the RITM associated with the Request Item and they have no option to add comments aswell. Please help its also seems this is only happening with ITIL users any idea

 

Added Screenshot of the view from an end user not able to see RITM

4 REPLIES 4

Omkar Mone
Mega Sage

Hi 

 

go to Service Portal -> Service Portal Configuration. then click on Portal Tables on the header menu then -> Menu Items.

 

search for My Requests. in the Server Script you can modify it to query the "sc_req_item" table.

vidhukeshvimal
Kilo Contributor

Below is the Script and i do see Sc_req_item getting queried Please help 

 

 

// maximum number of entries in this Menu
var max = 10;

var t = data; // shortcut
t.items = [];

var u = gs.getUser().getID();

// use record watchers to tell header when to update dropdown counts
t.record_watchers = [];
t.record_watchers.push({'table':'incident','filter':'active=true^caller_id=' + u});
t.record_watchers.push({'table':'sc_request','filter':'active=true^requested_for=' + u});

var st = new GlideRecord('service_task');
if (st.isValid()) {
t.record_watchers.push({'table':'service_task','filter':'active=true^opened_by=' + u});
st.addActiveQuery();
st.addQuery('opened_by', gs.getUserID());
st.orderByDesc('sys_updated_on');
st.setLimit(max);
st.query();
while (st.next()) {
if (!st.canRead())
continue;

var a = {};
$sp.getRecordValues(a, st, 'short_description,sys_id,number,sys_updated_on');
if (st.short_description.nil())
a.short_description = "(No description)";
a.__table = st.getTableName();
a.type = 'record';
a.sortOrder = st.sys_updated_on.getGlideObject().getNumericValue();
t.items.push(a);
}
}

var z = new GlideRecord('incident');
z.addActiveQuery();
z.addQuery('caller_id', 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, 'short_description,sys_id,number,sys_updated_on');
if (z.short_description.nil())
a.short_description = "(No description)";
a.__table = z.getTableName();
a.type = 'record';
a.sortOrder = z.sys_updated_on.getGlideObject().getNumericValue();
t.items.push(a);
}

var z = new GlideRecord('sc_request');
z.addActiveQuery();
z.addQuery('requested_for', gs.getUserID());
z.orderByDesc('sys_updated_on');
z.setLimit(max);
z.query();
while (z.next()) {
if (!z.canRead())
continue;

var ritm = new GlideRecord('sc_req_item');
ritm.addQuery('request', z.getUniqueValue());
ritm.query();
if (!ritm.next())
continue;

var a = {};
$sp.getRecordValues(a, z, 'sys_id,number,sys_updated_on');
if (ritm.hasNext()) // there are multiple items for this request
a.short_description = ritm.getRowCount() + ' requested items';
else if (!ritm.canRead()) // only one item, but user cannot see it
continue;
else // one item, and user can see it
a.short_description = ritm.cat_item.getDisplayValue() || ritm.getDisplayValue("short_description");
a.__table = z.getTableName();
a.type = 'request';
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

vidhukeshvimal
Kilo Contributor

not working? any more thoughts or ideas