Add a custom message to the reject popup

Pavan rishi
Tera Contributor

How can I add a custom message to the reject popup in an approval task on the ServiceNow portal when the Reject button is clicked?ss.PNG

2 REPLIES 2

RaghavSh
Kilo Patron

1. Go to sys_ui_message table.

2. Create an entry with key as "Provide a reason for rejecting this request".

3. In the message field give your custom message and save.


Raghav
MVP 2023

pavani_paluri
Giga Guru

Hi @Pavan rishi ,

 

Please clone OOB approval widget SC Approvals or My Approvals. Clone it. Inside your widget’s Client Script, find the part that runs when Reject is clicked.

Replace it with something like this:

$scope.reject = function() {
$uibModal.open({
template: `
<div class="modal-header"><h3>Reject Task</h3></div>
<div class="modal-body">
<p>Please enter a reason for rejection:</p>
<textarea ng-model="data.reason" class="form-control"></textarea>
</div>
<div class="modal-footer">
<button class="btn btn-default" ng-click="$dismiss()">Cancel</button>
<button class="btn btn-danger" ng-click="$close(data.reason)">Reject</button>
</div>
`,
controller: function($scope) {
$scope.data = { reason: '' };
}
}).result.then(function(reason) {
// Save the reason and update the task
$scope.data.reason = reason;
$scope.data.state = 'rejected';
$scope.server.update(); // This sends it to the backend
});
};

 

Mark it helpful if this helps you to understand. Accept solution if this give you the answer you're looking for
Kind Regards,
Pavani P