Use PDIs? Take our 5-minute survey to help shape the PDI roadmap.

Scripted List on Service Portal

rconstantino
Mega Sage

Good afternoon,

 

I have on my Service Portal two menu items that are a scripted list.

One for My Open Tickets and one for My Ticket History.

Here is a snippet from one of them (we also show REQs and a custom table)

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()) {
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);
}

 

Filtered list won't work because I can only select one table and we don't want multiple menu items.  We need to include all ticket types under My Open Tickets and My Ticket History.  I have them all included except for Tasks.

 

Using the above example is there a way to only display task records that start with TASK? 

 

As always,

Thank you in advance

Rachel

1 ACCEPTED SOLUTION

Rafael Batistot
Kilo Patron

Hi @rconstantino 

 

May you consider to use 

 

var z = new GlideRecord('task');
z.addActiveQuery();
z.addQuery('assigned_to', gs.getUserID());
z.addQuery('number', 'STARTSWITH', 'TASK');

 

If this response was helpful, please mark it as Helpful and, if applicable, as Correct.
This helps other users find accurate and useful information more easily

View solution in original post

2 REPLIES 2

Rafael Batistot
Kilo Patron

Hi @rconstantino 

 

May you consider to use 

 

var z = new GlideRecord('task');
z.addActiveQuery();
z.addQuery('assigned_to', gs.getUserID());
z.addQuery('number', 'STARTSWITH', 'TASK');

 

If this response was helpful, please mark it as Helpful and, if applicable, as Correct.
This helps other users find accurate and useful information more easily

Thank you for the assistance - this resolved my issue