How do I prevent change approvals from appearing in the Service Portal view?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2018 01:40 PM
Since our CAB approves change requests at their CAB meeting and we do not want any of these changes approved until then, we would like to remove all of the CHG approvals from appearing in the Service Portal view. Sometimes we may have 30 or more changes which hinder upper management from seeing other items that need approval.
I am a low code system admin and would like to see if there is a way to do this. I am relatively new to ServiceNow (been using it for 6 months) but am learning a lot. Many of the people in this forum have been very helpful with that too so thank you. I do know I have to modify the approval widget in the Service Portal but am still learning how to code in ServiceNow. Any help would be appreciated!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2018 02:52 PM
You should start by cloning the 'Approvals' widget and giving it the new widget a slightly different name.
in my personal dev instance I just called it My Approvals. However, you may want to call it 'Non-Change Approvals' or 'Request Approvals'.
After you have your own version of the widget look in the 'Client Script' area.
Find the line that looks like this:
spUtil.recordWatch($scope, "sysapproval_approver", "state=requested^approverIN" + $scope.data.myApprovals.toString());
You'll need to update the search criteria portion of this statement. "state=requested^..."
You can update it to look like this:
spUtil.recordWatch($scope, "sysapproval_approver", "state=requested^sysapproval.sys_class_name!=change_request^approverIN" + $scope.data.myApprovals.toString());
That will show all approval records except those associated with Change Requests.
You can modify it to more specific if you like. I got that by opening all approvals in a list view and putting on a filter to exclude Change request. I think right-clicked on the filter and clicked 'Copy query' to get the syntax.
Once your new widget is ready, you will want to pull the baseline 'Approvals' widget off your page(s) and replace it with your new widget.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-09-2020 08:24 AM
Thank you to all for posting this question and the solution, it is what I needed.