- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2024 05:59 AM
Hello All,
Currently i am working in incident from, in that from i need set when source field is ABC then Approvers field (u_approvers) maximum 2 entries are allowed to be selected, so i have tried the below script by using BR, but it's not working any one help one this?
(function executeRule(current, previous /*null when async*/) {
var maxApprovers = 2;
var approvers = current.approvers.toString().split(',');
if (approvers.length > maxApprovers) {
gs.addErrorMessage('You can select a maximum of ' + maxApprovers + ' approvers.');
current.setAbortAction(true);
}
})(current, previous);
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2024 06:44 AM
Yes, the field names referenced in scripts should be their true names (element), not their display names (column_label).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2024 06:29 AM - edited ‎08-01-2024 06:35 AM
Your script should work. You mention the incident table but approvers in the script is not a field that i see and you've referenced u_approvers in the text above. Have you validated the field name?
Additionally is this Business Rule running on Update and Insert and is the 'When' set to Before?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2024 06:41 AM
Yeah validated the field name is Approver and the backend name is u_approver , so i need change the approver to u_approver? And i m set the BR condition when set before
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-01-2024 06:44 AM
Yes, the field names referenced in scripts should be their true names (element), not their display names (column_label).