- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2026 10:40 PM
Hi,
I am working on a scenario where I need to add an additional filter called "On Behalf of Me", which should display all tickets that were created by me on behalf of other users on my ticket page in service portal.
Please refer to the screenshot below for reference.
Could someone help me understand how this filter can be created? Also, are any widget-level changes required to achieve this? If yes, could you please point me to the exact widget and the specific area where the changes need to be made?
Thank you in advance for your help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @zee15 ,
You can achieve this by customizing the My Requests widget in Service Portal. The requirement is to display requests created by the currently logged-in user on behalf of other users.
Here is how you can implement it.
Step 1: Clone the My Requests widget
Navigate to Service Portal → Widgets.
Search for My Requests.
Open the OOB widget.
Clone the widget and name it My Requests - Custom.
Make your changes only in the cloned widget to preserve OOB functionality.
Step 2: Update the HTML Template
Locate the existing View dropdown in the HTML Template.
Find:
<select ng-model="c.viewFilter"
id="view"
class="form-control adjust-width"
ng-change="c.changeView()"
ng-options="item.key as item.value for item in c.filterOptions">
</select>No structural HTML changes are required because the dropdown is already dynamically populated through the Client Controller.
Step 3: Update the Client Controller
Locate the existing c.filterOptions array.
Add one additional option:
c.filterOptions = [
{
key: 'open',
value: c.data.messages.openRequests
},
{
key: 'close',
value: c.data.messages.closedRequests
},
{
key: 'on_behalf',
value: 'On Behalf of Me'
}
];The new option will now appear in the View dropdown.
Step 4: Update the Server Script
This is the most important part.
In the Server Script, locate the existing function:
function getMyRequestSysIds() {
// Existing OOB logic
}After this function, add a separate function to retrieve requests created by the logged-in user for other users.
// Custom function: Get requests created on behalf of others
function getOnBehalfRequestSysIds() {
var ids = {};
var ritm = new GlideRecordSecure('sc_req_item');
ritm.addQuery('request.opened_by', gs.getUserID());
ritm.addQuery('requested_for', '!=', gs.getUserID());
ritm.addNotNullQuery('request');
ritm.query();
while (ritm.next()) {
var requestId = ritm.getValue('request');
ids[requestId] = {};
}
return ids;
}Explanation:
request.opened_by: Identifies the user who submitted the request.
requested_for: Identifies the user for whom the request was submitted.
gs.getUserID(): Returns the currently logged-in user's sys_id.
requested_for != gs.getUserID(): Excludes requests submitted for the logged-in user.
Step 5: Modify the Request Retrieval Logic
Find the existing code:
var myRequestMap = getMyRequestSysIds();
var taskIDs = Object.keys(myRequestMap);Modify it as follows:
var myRequestMap;
if (input && input.view == 'on_behalf') {
myRequestMap = getOnBehalfRequestSysIds();
alsoRequest = true;
} else {
myRequestMap = getMyRequestSysIds();
}
var taskIDs = Object.keys(myRequestMap);This ensures that the widget uses the custom query when the user selects On Behalf of Me, while retaining the original OOB logic for other views.
Step 6: Update the Active/Closed Filter Logic
In the existing GlideRecord query, locate:
if (input && input.view === 'open')
gr.addActiveQuery();
else if (input && input.view === 'close')
gr.addQuery('active', 0);
else
gr.addActiveQuery();Modify it to:
if (input && input.view === 'open') {
gr.addActiveQuery();
} else if (input && input.view === 'close') {
gr.addQuery('active', 0);
} else if (input && input.view === 'on_behalf') {
// Display both open and closed requests.
} else {
gr.addActiveQuery();
}Apply the equivalent condition in the search query section as well, so searching works with the new filter.
Step 7: Replace the widget on the Portal Page
- Open Service Portal Designer.
- Navigate to your Requests page.
- Remove the existing My Requests widget instance.
- Drag your cloned My Requests - Custom widget onto the page.
- Save the page.
When the user selects On Behalf of Me, the widget should display requests submitted by the logged-in user for other users.
Important: This example is for catalog requests using the sc_request and sc_req_item tables. The Requested For field on the RITM should be populated correctly. Also, if a single REQ contains multiple RITMs for different users, the widget will display the parent REQ if at least one RITM matches the condition.
Hope this helps! If this resolves your issue, please mark the response as helpful and accept it as the solution.
Regards,
Sandesh Powar
ServiceNow Rising Star
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2026 11:12 PM
see this
Customizing the "My Requests" Widget in Service Po... - ServiceNow Community
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Ankur Bawiskar the same steps mentioned in the link you provided, but it's still not working. I'm not sure how or from where I can access this filter in the my-request-V2 widget.
Please see the screenshots below for reference.
Could you please help me identify what I might be missing?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-21-2026 11:31 PM
@zee15 ,
Yes Adding a new filter will require customization of OOB widget named as 'My Requests' .
You need to clone that widget and do customizations.
Refer this thread to do customizations for that widget My Requests Widget Customizations
If my response helped, mark it as helpful and accept the solution.
Thanks,
Dinesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Dinesh Chilaka,