State Flows or State Model

John Kelly1
Tera Expert

We have created a custom scoped application which has a core table extending task.  State control looks like it can be achieved using either State Model or by using the State Flows (need to activate the plugin).  Both are good choices for defining which states can be selected but the State Flows looks superior in that it  helps to auto-build the UI actions, script includes etc. 

The State Model option looks like one needs to completely build out the UI action support.

Is there anything else that needs to be considered in deciding whether to use State Flows or State Model.

4 REPLIES 4

Saurabh singh4
Kilo Guru

Hi John Kelly

As per my knowledge state flow and state model both have the same capabilities, Iam giving you some points hope this will help you to understand better 

1. Flow Formatter [sys_process_flow] defines the process stages.

2. State Flow [sf_state_flow] manages behavior of fields, field visibility on the form, and system events for state transitions.

sf_state_flow --> Contains state flow definitions. This table contains all state flow definitions, including those for work orders and work order tasks.

 

sys_state_model --> Defines how each record in the target table transitions to (the enter condition) and/or from (the exit condition) each state predefined for that table.

 

"A state model is a list of states that describe an expected record workflow through the lifecycle of the record. State models can be defined for any table that extends the task table. State models simplify defining the state transitions allowed for a specific task type."

 

Please see quick video below to configure custom process formatter

 

https://www.youtube.com/watch?v=ve52RRXjAbs

 

 Please mark my  answer correct and helpful, If this helps you in any way.

Saurabh

Thanks for your reply Saurabh.  I have read the documentation and used them both and the process formatter but I am wondering about the pros and cons of using one over the other. 

In particular the UI actions in the Problem OOB example use a custom UI action which looks to require quite a lot of effort to build something for a custom table.

Still, the State Model is active OOB and so one wonders if ServiceNow is implicitly preferring that as an approach - nothing I could find in the Docs so it may remain an open question.

Indrajit
Mega Guru

Hey John,

A State flows have two possible uses. Manual creates a UI action. Automatic creates a business rule.

UI actions are manually triggered - a human has to click the button or link.

Business run based on database operations (save, update, delete, etc.)

state model is a list of states that describe an expected record workflow through the lifecycle of the record. State models can be defined for any table that extends the task table. State models simplify defining the state transitions allowed for a specific task type

 

Please refer the Below Link for State Flows vs State Model,

https://community.servicenow.com/community?id=community_article&sys_id=032de6e5dbd0dbc01dcaf3231f961...

https://community.servicenow.com/community?id=community_question&sys_id=0d06525fdb90a7c854250b55ca96...

Please Mark Correct and Helpful If you find content useful.

Regards,

Indrajit.

John Kelly1
Tera Expert

Thanks Idirajit, I think for custom tables State Flows looks the way to go.