Purpose of State in State Machine

hello everyone, I want to explore the actual application of EXIT STATE activities in State Activity. I know when to trigger a case with different conditions, and what should it do in Entry State and the transition to next state… but just have a question that I never use EXIT STATE activity… or I did all I need in ENTRY STATE and no reason to have extra activity in EXIT STATE.. is there any insight from you guys? Thanks.

The Exit State activity is mainly designed for:

  • Cleanup & resource release before leaving a state.
  • Resetting variables, flags, or temp data used inside the state, so they don’t affect the next state.
  • Closing connections, killing sessions, logging exit-specific information.
  • Any action that should be performed only when leaving the state, and not during entry or transition.

For your question - It will work as expected without giving value in exit state. But as i have mentioned in the above points - If any of these are valid in your case - It is best suited to provide in the exit state.

@edmondlaw

1 Like

Hi @edmondlaw
Welcome to UiPath,

In State Machine, the Exit State activity is optional and mainly used for cleanup tasks, logging, or finalizing operations before leaving a state. If everything is handled in Entry State and transitions, you may not need it. However, use Exit State when you require actions that must execute only when leaving a state, regardless of which transition occurs.

Happy Automation

@edmondlaw

Welcome to community!!

in State activity, we have three section,

  1. Entry is used to build your business logics from start to end
  2. Exit will used after completing entry block it can be optional it wont create any problem whether you can use not
  3. Transition where you connect one state to another along with conditions

and try to look below documentation as well, you will get more info about the sate activities.

Happy Automation!!