- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:31 AM
Hello Team,
Can anyone suggest how to achieve this requirement?
If the approver = created by user(Requested for) then they should not be able to approve the request.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 08:20 AM
Here is a BR that I think will do the job.
Condition: current.source_table == 'sc_req_item' && current.sysapproval.opened_by == current.approver
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.approver = current.approver.manager;
current.comments = 'Approver is also Requester - Moved to Manager';
})(current, previous);
It was modified from a BR that I've used to auto-approved if Requester is also Approver. I haven't tested it.
Regards,
Niklas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 08:08 AM
Hi,
That would be a custom BR that needs to be built.
Regards,
Niklas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 08:20 AM
Here is a BR that I think will do the job.
Condition: current.source_table == 'sc_req_item' && current.sysapproval.opened_by == current.approver
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.approver = current.approver.manager;
current.comments = 'Approver is also Requester - Moved to Manager';
})(current, previous);
It was modified from a BR that I've used to auto-approved if Requester is also Approver. I haven't tested it.
Regards,
Niklas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 08:30 AM
@Niklas Peterson :Which Table do need to use?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 08:32 AM
To run the BR on? The sysapproval_approver table.
Regards,
Niklas
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2023 07:38 AM
(function () {
var current = g_form.getTableName();
var currentUserID = g_user.userID;
var requestedForID = g_form.getValue('requested_for');
if (currentUserID == requestedForID) {
g_form.setReadOnly('approval', true);
g_form.addInfoMessage('Self-approval is not allowed.');
} else {
g_form.setReadOnly('approval', false);
g_form.clearMessages();
}
})();