How can I run state workflow on changing dropdown value?

There is dropdown named State in every order. After user change its value from Created to Accepted, I need to run a transformation, that generates an invoice.

The state workflows are built for exactly such a problem. So

  1. Create a state workflow on Order’s state column, make sure that a column has a default lookup defined on entity-level (Bussiness Logic > State Workflows > RightClick > New State Machine, fill in Entity and Field)
  2. Define all possible status values (for each please right click on your newly created state workflow and select New state). Add a state and define, whether state is initial, running, or final.
  3. Create allowed transitions between them - e.g. go to start state Created, click right buton and select New Operation and fill-in target state Accepted. Name the operation - e.g. Accept order. This way define all allowed state transitions (create state machine transitions).
  4. Once you are done create a new state machine event of type StateTransition and fill-in Created as a NewState and Accepted as an OldState. And as an Action fill-in a sequential workflow which will generate an invoice (.rovided that you created such a workflow before).
  5. Define set of parameter (right click on your newly created event and select New > Parameter Mapping) to pass them to the workflow - possibly id of an order. The workflow will then load the whole order according to given id and as a next step call your transformation that generates you new invoice.
1 Like

One remark: Don’t forget to set value for Roles in the operation (step 3).
Thank you, Vaclav.