Making rejection comment mandatory on service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2021 01:25 PM
I already have a Approve and reject widget on service portal like this
Now I only want to make rejection comment mandatory if approver rejects the request with the pop up if they don't fill in the rejection comment. Kindly guide me as I am new to service portal area.
- Labels:
-
Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-20-2021 03:47 PM
Hi Ankita,
First you will need to clone the Approvals widget.
In your copy, add the spModal directive to the existing first line of the Client controller script:
function ($scope, spUtil, spUIActionsExecuter, spModal)
Then you will need to modify the reject function in the Client controller script something like this:
$scope.reject = function(id, esigRequired) {
spModal.open({
title: 'Reject Approval',
message: 'Please enter your reason for rejection, note this will be communicated with the requestor',
input: true,
value: $scope.name
}).then(function(name) {
$scope.name = name;
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 {
$scope.data.op = "rejected";
$scope.data.target = id;
$scope.data.reject_comment = "Rejection reason: " + $scope.name;
get();
}
});
};
Then you will need to update the input on the server script something like this:
if (input) {
// update pagination
currentPage = input.pagination.currentPage;
initRow = (currentPage * maxNumberOfItemsInTheList);
lastRow = initRow + maxNumberOfItemsInTheList;
if (input.op == 'approved' || input.op == 'rejected') {
var app = new GlideRecord("sysapproval_approver");
if (app.get(input.target) && app.state.canWrite()) {
app.state = input.op;
if(input.op == 'rejected')
{
app.comments = input.reject_comment;
}
app.update();
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2021 01:21 AM
I have clone widget, but will you please guide me how to add it to spModal directive
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-21-2021 05:18 AM
Sure, that's just line 1 of the Client controller section. Everything is already there except the last parameter. I'll update the above instructions to clarify that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-04-2021 11:39 PM
These help me to achieve pop for bulk approvals. Thanks alot.
but the rejection comment is single line text. I want multiple line text. can we achieve that.