State Machine Execution Sequence

Anyone knows the correct answer to this question and can explain why please?

@Palaniyappan perhaps u can help with this

Maybe this can help

  1. Activity in entry section are performed

  2. Activity inexit section are performed

  3. Trigger condition are evaluated

  4. Activity in trigger action are performed

I think this is the order

A state can have an Entry and an Exit action. (A state configured as a final state may have only an entry action). When a workflow instance enters a state, any activities in the entry action execute. When the entry action is complete, the triggers for the state’s transitions are scheduled. When a transition to another state is confirmed, the activities in the exit action are executed, even if the state transitions back to the same state. After the exit action completes, the activities in the transition’s action execute, and then the new state is transitioned to, and its entry actions are scheduled.

1 Like

image


image
As you can see, I created a very simple state machine, in one state I just put log messages to track the order. According to this the answer is:

4
2
1
3

6 Likes
  1. Entry section
  2. Trigger action
  3. Trigger conditions are evaluated
  4. Exit section

If you need clear explanation why it works so, then search for “UiPath State machine UiPath RPA” in youtube, you can see the first video uploaded by the user “UiPathRPA”

@NIVED_NAMBIAR @Surya_Narayana_Korivipadu @jack.chan @Umut_G @dion.chan @Brett_Gates @Parth_Doshi @Priyanka_Bhalere @nisargkadam23 @Ishmeet_Bindra

How to convert sequence into state machine ?
what are the conditions to observe to convert ?
Please share one example done with both sequence and state machines

Refer this link

UiPath State Machine| State Machine Workflow UiPath | UiPathRPA
[

UiPath State Machine| State Machine Workflow UiPath | UiPathRPA

](UiPath State Machine| State Machine Workflow UiPath | UiPathRPA - YouTube)

You can find good explanation about state machine with examples. Take a simple example from this tutorial and try to build a state machine and also try to build the same thing with a sequence. Relate that tutorial to traffic lights scenario. You’ll understand it better.

But I don’t suggest using state machines when your process is simple and linear. You can simply take a sequence. Check the process complexity and use state machine only if it fits the state machine logic.

1 Like

This answer is incorrect. I validated Umut’s proof.

  1. State Entry Action
  2. Trigger Evaluation
  3. State Exit Action
  4. Trigger Action
3 Likes

What’s this Umut’s proof?

In the state machine transition, they gave “Trigger” and “Action”
image

I assumed, “Action” as trigger action and so I gave

  1. Entry
    2.Trigger conditions are evaluated
  2. Exit
  3. Trigger Action

But if the “Trigger” is trigger action, then

  1. Entry
  2. Trigger Action
  3. Trigger conditons are evaluated
  4. Exit

So I think the question given by UiPath practice test , itself is not clear.

See entry in this thread from Umut_G on March 26. I ran the same test and go the same results as Umut.

Got it. But if we carefully observe this image, the log message inside the “Action” part, it is given as “T1 condition”

The part mentioned in T1 Condition, 1=1 is the condition but not the “Action” part. The messages in the “Log Message” activities are not properly written in Umut’s post

@Surya_Narayana_Korivipadu is right and also @Umut_G 's screenshot does not show otherwise, on the contrary.

It’s a matter of semantics, mostly, combined with a tricky formulated question + very confusing naming conventions for Transition sections. :slight_smile:
The Transition Condition is actually being evaluated between log messages “T1 trigger” and “exit”.

Here’s a rather detailed logging of what’s happening (my Value gets incremented in Trigger Action):
state-2021-05-14_19-04-40

The Transition Condition is being evaluated each time Trigger Action activities get executed, but you can only observe that if you log activities:
state-2-2021-05-14_19-04-40

So the correct answer will be:

  1. Activities in the Entry section are performed
  2. Activities in Trigger Action are performed
  3. Trigger Conditions are evaluated (if False repeat step 2 until True)
  4. Activities in Exit section are performed.

if there was a 5th option, that will be:

  1. Activities in the Condition Action branch are performed.

I know, they could have named those differently… :smile:

6 Likes

Perfect explanation @Marius_Vrancianu

The sequence in which state machine is executed is

  1. Entry section is performed
  2. Then the Trigger condition is evaluated
  3. Then it executes the exit section
  4. At last the if trigger condition is true the trigger action is performed

bryansenter is correct