Receiving an Alert level: critical. Invalid value on Update in the SOW workspace

cbaumert01
Tera Contributor

 

Hello,

I am encountering an issue when attempting to cancel an incident in the SOW (Service Operations Workspace) workspace. The error I receive is:

"Invalid value on update"

Context:

  • I have a business rule in place that checks if the incident state is being changed to either "Canceled" (state = 8 or "On Hold" (state = 3).
  • If the state change occurs without any value in the Additional Comments (comments) field, the business rule prevents the update and displays an error message.
  • The business rule works fine when changing the state to "On Hold", but throws the "Invalid value on update" error when attempting to change the state to "Canceled."

Business Rule Details:

  • Name: Additional Comments
  • Table: Incident (incident)
  • When to Run: Before
    • Insert: True
    • Update: True
    • Delete: False
    • Query: False
  • Condition: (Attached screenshots show conditions — please refer to them for details.)

Business Rule Script:

 
(function executeRule(current, previous /* null when async */) { // Check if the incident state is changing to '8' (Canceled) or '3' (On Hold) if ((current.incident_state.changesTo('8') || current.incident_state.changesTo('3')) && current.comments.nil()) { // Display an error message to notify the user gs.addErrorMessage('You must provide a reason in Additional Comments before changing the incident state.'); // Prevent the update from saving (this stops the state change) current.setAbortAction(true); // Explicitly revert the state to its previous value current.incident_state = previous.incident_state; // Exit the script immediately to stop the update return; } })(current, previous);
 

Troubleshooting Attempts:

  • Verified that the business rule triggers correctly in other scenarios.
  • Confirmed that the comments field (comments) is included in the form layout.
  • Checked that the state values match the system dictionary for the incident_state field.

Questions/Assistance Needed:

  1. Why does this error occur only when changing the state to "Canceled"?
  2. Are there any known limitations or differences in state handling between "Canceled" and "On Hold" in SOW workspace?
  3. Is there a recommended approach to modify the script to prevent this error?

Any insights or suggestions would be greatly appreciated!

Thank you!
Screenshots attached for reference.

2 REPLIES 2

RobertB61064003
Tera Contributor

Hey @cbaumert01 , 

 

Were you able to resolve this? Having the same issue. 

 

Cheers

Rob

kaushal_snow
Mega Sage

Hi @cbaumert01 .

 

For one of your scenario, follow below steps:

 

To avoid the Invalid value on update error specifically when canceling, consider these adjustments....

 

1. Use gs.addErrorMessage() + return false Instead of setAbortAction

if ((current.incident_state.changesTo('8') || current.incident_state.changesTo('3')) && current.comments.nil()) {
gs.addErrorMessage('You must provide a reason in Additional Comments before changing the incident state.');
return false;
}


This will stops the update, displays the message, but avoids possible inconsistencies from setAbortAction plus manual state reverting.....

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/