- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 10:18 AM
I am using a clone of the 'Approvals' widget on my Service Portal homepage. The only difference between this clone and the OOB Approvals widget is line 141 in the Server Script:
data.showApprovals = true; //Changed from - gs.getUser().hasRole('approver_user'); - to allow all users to view widget
The widget is functioning as expected and showing approvals for all users just fine. The only issue is that the "Approve" and "Reject" buttons do not do anything when clicked unless you are an admin.
Other posts have suggested looking at ACLs on sysapproval_approver.state and making sure sysapproval_approver.state is not set to read-only. I have already checked these and everything looks fine there.
I'm not great at deciphering widget code and so far I have only made minor adjustments to cloned widgets, so I'm trying to understand what these buttons check for and do in the code. I'm leaning towards the "esignature" in the Client Script being the culprit but I'm not even sure what that does. Idk, I'm lost lol.
Any help would be appreciated, thank you!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2023 06:25 AM
I figured it out.
So I added some debug on the $scope.approve and $scope.reject functions, and everything looked like it was checking out. I figured this must be access-related since I, as an admin, am able to use the buttons correctly. Ended up taking another look at the Server Script to see how the approvals/rejections get handled on that side, and I noticed that there's a condition when accepting the user input on line 19:
if (input.op == 'approved' || input.op == 'rejected') {
var app = new GlideRecord("sysapproval_approver");
if (app.get(input.target)) {
var isMine = gs.hasRole("approval_admin") || (gs.hasRole("approver_user") && isApprovalMine(app));
if (isMine) {
app.state = input.op;
app.update();
Noticed this was similar to the code I mentioned in my original post that was affecting the visibility of the widget itself. I removed the check for gs.hasRole("approver_user") and now it works for everyone:
if (input.op == 'approved' || input.op == 'rejected') {
var app = new GlideRecord("sysapproval_approver");
if (app.get(input.target)) {
var isMine = gs.hasRole("approval_admin") || isApprovalMine(app); //changed from || (gs.hasRole("approver_user") && isApprovalMine(app));
if (isMine) {
app.state = input.op;
app.update();

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-07-2023 11:32 AM
The next step would be to add some debug statements to the client controller code to see if you are getting the right value in id field or to check if on click it is entering this function or not. You can use alert() to debug.
Please mark this response as correct or helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-08-2023 06:25 AM
I figured it out.
So I added some debug on the $scope.approve and $scope.reject functions, and everything looked like it was checking out. I figured this must be access-related since I, as an admin, am able to use the buttons correctly. Ended up taking another look at the Server Script to see how the approvals/rejections get handled on that side, and I noticed that there's a condition when accepting the user input on line 19:
if (input.op == 'approved' || input.op == 'rejected') {
var app = new GlideRecord("sysapproval_approver");
if (app.get(input.target)) {
var isMine = gs.hasRole("approval_admin") || (gs.hasRole("approver_user") && isApprovalMine(app));
if (isMine) {
app.state = input.op;
app.update();
Noticed this was similar to the code I mentioned in my original post that was affecting the visibility of the widget itself. I removed the check for gs.hasRole("approver_user") and now it works for everyone:
if (input.op == 'approved' || input.op == 'rejected') {
var app = new GlideRecord("sysapproval_approver");
if (app.get(input.target)) {
var isMine = gs.hasRole("approval_admin") || isApprovalMine(app); //changed from || (gs.hasRole("approver_user") && isApprovalMine(app));
if (isMine) {
app.state = input.op;
app.update();