How can I filter search results to only show Requests and Incidents from Service Portal View All link? We have the following from out of the box Service Portal (Helsinki): var link = {title: gs.getMessage('View all requests'), type: 'link', href: '?

Kamran1
Kilo Guru

How can I filter search results to only show Requests and Incidents from Service Portal View All link? We have the following from out of the box Service Portal (Helsinki):  

var link = {title: gs.getMessage('View all requests'), type: 'link', href: '?id=list&table=task&filter=active%3Dtrue%5Eopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe%5EEQ', items: []};e

View all requests in the above points to task table which shows anything in the task table such as requested items, tasks, incidents and requests. I would appreciate if anyone could point out how to further filter results to only show Requests and Incidents submitted by the end user and filter out the rest. I am fairly new to Service Portal and no scripting background.

Thanks,

Kamran

1 ACCEPTED SOLUTION

marcguy
ServiceNow Employee
ServiceNow Employee

Arh I see the issue, it's bascially saying at the moment table is task OR sys_class_name is... and it should be



table is task AND sys_class name is....


active%3Dtrue%5Esys_class_name%3Dincident%5EORsys_class_name%3Dsc_request



so full url would be


var link = {title: gs.getMessage('View all requests'), type: 'link', href: '?id=list&table=task&filter=active%3Dtrue%5Esys_class_name%3Dincident%5EORsys_class_name%3Dsc_request%5Eopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe%5EEQ', items: []};


View solution in original post

5 REPLIES 5

marcguy
ServiceNow Employee
ServiceNow Employee

you would need to add the sys_class_name=incident OR sys_class_name=sc_request to the URL syntax



%5EORsys_class_name%3Dincident%5EORsys_class_name%3Dsc_request


Thanks and I really appreciate your help. I updated the syntax with the above suggestion but the end users still see RITM, TASK, REQ and INC. Here is what the syntax looks like now:



var link = {title: gs.getMessage('View all requests'), type: 'link', href: '?id=list&table=task&filter=active%3Dtrue%5EORsys_class_name%3Dincident%5EORsys_class_name%3Dsc_request%5Eopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe%5EEQ', items: []};



I also noticed that when the end user back tracks filter (removes opened by option) it gives them a list of all tickets which we don't want.



Is there anyway we could hide this filter (All > Active=true.or.Task type=Incident.or.Task type=Request>Opened by is) from the end user display so they only see tickets opened by them? They are not able to see the ticket content if they don't have ITIL role but still see all ticket links.



I have attached screenshot.


marcguy
ServiceNow Employee
ServiceNow Employee

Arh I see the issue, it's bascially saying at the moment table is task OR sys_class_name is... and it should be



table is task AND sys_class name is....


active%3Dtrue%5Esys_class_name%3Dincident%5EORsys_class_name%3Dsc_request



so full url would be


var link = {title: gs.getMessage('View all requests'), type: 'link', href: '?id=list&table=task&filter=active%3Dtrue%5Esys_class_name%3Dincident%5EORsys_class_name%3Dsc_request%5Eopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe%5EEQ', items: []};


Thats excellent! I was able to filter to only display requests and incidents. I also used ^ operator to display active and non active tickets as users want to see closed tickets. So the URL looks like this now:



id=list&table=task&filter=active%3Dtrue%5EORactive%3Dfalse%5Esys_class_name%3Dincident%5EORsys_class_name%3Dsc_request%5Eopened_byDYNAMIC90d1921e5f510100a9ad2572f2b477fe%5EEQ.



Any idea on my other request how to hide the filter from the form or hide part of it? Screenshot below.



find_real_file.png