Make the attachment and comments needs to mandatory.Error Message "Invalid value on Update"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday - last edited 35m ago
Hi ,
in approval table make comments mandatory when they get approve , but get another error message along with custom error message as "Invalid value on Update". Usinge BR I tried to make comments mandatory.
is it possible remove that error message.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @armanoj
Try this:
Create/Update a Before Business Rule
- Navigate to System Definition > Business Rules.>Click New and fill in the fields:
- Name: Make Comments Mandatory on Approval
- Table: Approval [sysapproval_approver]
- When: Before
- Insert: Checked
- Update: Checked
Condition tab, set:
- State changes to Approved
(function executeRule(current, previous /*null when async*/) {
if (gs.nil(current.comments)) {
gs.addErrorMessage('Comments are mandatory when approving or rejecting.'');
current.setAbortAction(true);
}
})(current, previous);
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @armanoj ,
The custom error message is coming from your Business Rule, but the additional "Invalid value on Update" message is standard platform behavior. When the approval action tries to save the record and the update is aborted using current.setAbortAction(true);, ServiceNow automatically throws its generic database validation message alongside your custom message.
Here are two ways to handle this, depending on your needs:
Option 1: The Cleaner Approach (Recommended)
To completely eliminate the "Invalid value on Update" message, the platform best practice is to move this validation out of a Business Rule and into a Data Policy. A Data Policy enforces the rule securely at the server level but handles the UI error messaging gracefully.
Navigate to System Policy > Rules > Data Policies.
Create a new policy for the sysapproval_approver table.
Condition: State is Approved OR State is Rejected.
Add a Data Policy Rule for the Comments field and set Mandatory to True.
Option 2: Optimize Your Business Rule
If you have a strict requirement to keep this in a Business Rule, you must accept the double-message. However, you should update your script. Using gs.nil() directly on a journal field can be unreliable.
Update your script to check getJournalEntry(1) and ensure it only fires on the correct states:
// Check if the state is changing to approved/rejected and if the journal entry is empty if ((current.state == 'approved' || current.state == 'rejected') && gs.nil(current.comments.getJournalEntry(1))) { gs.addErrorMessage('Comments are mandatory when approving or rejecting.'); current.setAbortAction(true); }
Additional things to check if you stick with the Business Rule:
Ensure this is a Before Update Business Rule.
Check if there are any conflicting Data Policies, Client Scripts, or UI Policies running on the same table.
Hope this helps!
Please mark this answer as Helpful if it resolves your question. 🙂
Thanks, Yogesh Bhatt
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
36m ago
As per my reguirement approval table make the attachment and comments needs to mandatory.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @armanoj
That secondary "Invalid value on Update" message is a classic ServiceNow annoyance.
It happens because of how current.setAbortAction(true) works. When your Business Rule forcefully aborts the database transaction, the platform's UI detects that the save failed unexpectedly. As a fallback, ServiceNow automatically throws that generic "Invalid value" or "Invalid Update" error to ensure the user knows the record didn't actually save, right alongside your custom message.
Note: You can use onSubmit Client script or Data Policy to make your comments mandatory before approval.
Happy to help! If this resolved your issue, kindly mark it as the correct answer ✅ and Helpful and close the thread 🔒 so others can benefit too.
Warm Regards,
Deepak Sharma
Community Rising Star 2025