
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2019 01:08 PM
On the Approve widget on the Service Portal index page, I am attempting to either 1. Make the Approve and Reject buttons force a comment or 2. remove the Approve/Reject buttons altogether. We want to keep the 'Options' so that the person can review the the item being approved. I have seen this done for the Approval info widget. My script-fu is not quite there yet, so I have been relying on snippets from other community posts and other areas. Essentially, if we keep the buttons, I need a comments box, and a way to make either just Reject or both Approve and Reject require a comment.
This is what we currently have. Any assistance is greatly appreciated. My Test instance is in Madrid and my QA/Prod are in London.
Solved! Go to Solution.
- Labels:
-
Multiple Versions
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2019 08:06 AM
The answer has been found. There was a reply by @manishm on this post. Edits to the code are in Red. I added an attachment to show the results.
______________________________________________________________________________________
Changes to Approvals Widget that shows up on the index page to capture Rejection Comments:
Server Script
if (input.op == 'approved' || input.op == 'rejected') {
var app = new GlideRecord("sysapproval_approver");
if (app.get(input.target)) {
app.state = input.op;
if (input.comments) {
app.comments = input.comments;
}
app.update();
}
}
Client Controller
function ($scope, spUtil, spUIActionsExecuter, spModal) {
...
$scope.reject = function(id, esigRequired) {
var requestParams = {
username: $scope.data.esignature.username,
userSysId: $scope.data.esignature.userSysId
};
if($scope.data.esignature.e_sig_required && esigRequired) {
spUIActionsExecuter.executeFormAction(ESIGNATURE.REJECT_SYS, "sysapproval_approver" , id, [] , "", requestParams).then(function(response) {
});
} else {
spModal.prompt("Please enter reason for rejection").then(function(rejectReason) {
$scope.data.op = "rejected";
$scope.data.target = id;
$scope.data.comments = rejectReason;
get();
});
}
}
...
}
______________________________________________________________________________________

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-07-2019 01:42 PM
you can refer below to provide approve, rejection buttons in SP.
https://serviceportal.io/create-custom-action-buttons-service-portal/
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2019 08:06 AM
The answer has been found. There was a reply by @manishm on this post. Edits to the code are in Red. I added an attachment to show the results.
______________________________________________________________________________________
Changes to Approvals Widget that shows up on the index page to capture Rejection Comments:
Server Script
if (input.op == 'approved' || input.op == 'rejected') {
var app = new GlideRecord("sysapproval_approver");
if (app.get(input.target)) {
app.state = input.op;
if (input.comments) {
app.comments = input.comments;
}
app.update();
}
}
Client Controller
function ($scope, spUtil, spUIActionsExecuter, spModal) {
...
$scope.reject = function(id, esigRequired) {
var requestParams = {
username: $scope.data.esignature.username,
userSysId: $scope.data.esignature.userSysId
};
if($scope.data.esignature.e_sig_required && esigRequired) {
spUIActionsExecuter.executeFormAction(ESIGNATURE.REJECT_SYS, "sysapproval_approver" , id, [] , "", requestParams).then(function(response) {
});
} else {
spModal.prompt("Please enter reason for rejection").then(function(rejectReason) {
$scope.data.op = "rejected";
$scope.data.target = id;
$scope.data.comments = rejectReason;
get();
});
}
}
...
}
______________________________________________________________________________________
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-27-2020 01:39 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2020 05:14 AM
Hi!!
I have the same problem with the asterisk.
Did you figure out how to fix it?
Thanks.