Is it possible to override State Model transitions through a script (e.g., BR or FS)

Sathwik1
Tera Guru

We are currently using a State Model to control state transitions on the Problem table.

However, we have a requirement where we are updating the State using a Fix Script / Business Rule.

 

Due to the configured State Model, the update is being restricted and the record is not moving to the intended state.

So, I want to understand:

  • Is it possible to bypass or override State Model restrictions through scripting?
  • If yes, what is the recommended approach to achieve this?

setWorkFlow(false) - This is not working,

Any guidance or best practices would be helpful.

 

@Tanushree Maiti 

1 ACCEPTED SOLUTION

Hi @Sathwik1 

 

Refer  KB0759295  :System enforces the state transition (through com.snc.state_model.StateTransitionValidator) and does...

 

Issue

When the State Model and Transitions are enabled on a table ,System enforces the state transition (through com.snc.state_model.StateTransitionValidator) and does not allow transition of state through Business Rule / Script,  if it does not validate against existing model transition.

 

Cause

This is an expected behavior as designed, The state transition will be enforced as configured for the table. System will not allow any invalid state transition on the record through the UI or script.

Please review > Add a state model and transitions

Resolution

If you want to allow the update on the state , through Business Rule / API Script, the following System property can be used to disable the "StateTransitionValidator"  

com.glide.record.state.validation = false

If the property above is disabled system will not validate and allow transition to any state on the record that is done through the script / business rule.
Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
Regards
Tanushree Maiti
ServiceNow Technical Architect
Linkedin:

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron

@Sathwik1 

you can override that but I won't recommend doing that.

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader