force comment on change request rejection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 02:10 PM - edited 10-04-2024 02:10 PM
I have set up the business rule to force comment on change request rejection but it does not seem to work:
Create a Business Rule:
Navigate to System Definition > Business Rules.
Click New to create a new Business Rule.
Fill out the following fields:
Name: Require Comments on Change Approval Rejection
Table: Approval [sysapproval_approver]
Advanced: Check this option to enable scripting.
When: Before Update
Order: (You can leave it as default unless there are other Business Rules that might conflict.)
Condition: Leave blank; we'll use scripting to define the condition.
Script:
// Only proceed if state is changing to 'rejected'
if (current.state.changesTo('rejected')) {
// Check if the approval is for a Change Request
var sysapprovalGr = current.sysapproval.getRefRecord();
if (sysapprovalGr.getTableName() == 'change_request') {
// Enforce that Comments are provided
if (gs.nil(current.comments)) { // Replace 'comments' with the actual field name if different
gs.addErrorMessage('Please provide a comment before rejecting the approval.');
current.setAbortAction(true); // Prevents the record from being saved
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-04-2024 10:52 PM
Hi @RBlor ,
There is already an OOB UI Policy which makes comments mandatory when state changes to Rejected.
Name: Comments mandatory on rejection.
If the above information helps you, Kindly mark it as Helpful and Accept the solution.
Regards,
Najmuddin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2024 01:07 AM - edited 10-12-2024 07:10 AM
Hey @RBlor, you could use a combination of both UI policy and business rules to ensure everything works properly. Have you checked if the UI policy Najmuddin mentioned is active on your form? Perhaps considering portable restroom rental for larger events or outdoor gatherings could also be beneficial.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2024 02:23 PM - edited 10-09-2024 02:32 PM
this is active but change managers can right click and approve on the approvers tab related list on the change request.