StateMachine understanding, weird behavior of trigger executed twice

Hi all,

This is my very first post, so I’ll hope i’ll repect the rules :slight_smile:

I’m learning state machine, and had a look to microsoft documentation, uipath documentation and academy video before posting but, i encounter something wierd to me.

In the REFramework, I put log messages in order to be sure of what is executed when (Entries, Triggers, Transitions, Exit, …). I think I have a prettry clear idead of how it works, here what I understand (not the full details):

  • Going through Init State
    • Entry actions are executed
    • Outgoing triggers are fired (as there is only a shared trigger, only 1 trigger is executed here)
    • And eventually doing Exit actions but there is no exit actions there
  • As Success Condition is evaluated to True, then, the sucess transition actions are executed
  • Then Get Transaction Data is executed
    • Entry actions are executed
    • Outgoing triggers are fired (as its a shared trigger, only 1 trigger is executed here)
    • Exit actions (but there is none here) are executed
  • As New Transaction condition is evaluated to True, the success transition is executed
  • Then get Process Transaction executed
    • Entry actions are executed
    • Outgoing triggers are fired (the 3 differents triggers here are executed)
    • Exit actions (but there is none here) are executed
  • As Success condition is evaluated to True, the success transition is executed
    Then it loop until there is no Data anymore and process is ended.

Pretty clear.

(Sorry, need to continue here as there is a limitation of 1 image / post for beginners)

But, when i’m replicating this in a basic state machine, i encounter a behavior that i don’t understand and i don’t get the difference causing that:

  • Going through Init State (Entry, Triggers, Exit)
    • Shared Trigger is executed
  • InitOK condition evaluated to True
  • InitOK transition executed
  • Process state executed (Entry, Triggers, Exit)
    • ReInit trigger is executed
    • ProcessDone trigger is executed
    • => And then ReInit trigger is executed again, i don’t understand why?
  • ProcessDone condition is evaluated to True
  • ProcessDone transition is executed
    End state is executed

Is there someone that can explain what i’m missing here? Why this RetryInit trigger is executed twice? bullet point (6) on the screenshot should not exist to me, and is not existing in REFramework template.

Thanks a lot in advance for you help on that!

Hi @sre, I know it’s been some time since you post this, What is the condition in RetryInit trigger?
I would imagine that RetryInit would run again, if it was connected to the process in a loop, or if Process state has exit activity to log a message “RetryInit” trigger (and you entered it there by accident).

1 Like

Hi sre,

I also stumbled on this issue. It seems like UiPath transitions are being checked in order for a trigger. The fix for me was to make the condition unique. So if you have a retry int variable, construct both conditions to check that value. Otherwise if the first transition complies with that condition, it will continue that path. So like ValeriiaProtsko said, check the logic in the conditions.

I created a variable with a retry count and a variable to save the exception message. If the retry is under 3, and there is a general exception, it retries the init phase.

image

Tuna