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
- 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 inEntity
andField
) - 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 isinitial
,running
, orfinal
. - Create allowed transitions between them - e.g. go to start state
Created
, click right buton and selectNew Operation
and fill-in target stateAccepted
. Name the operation - e.g.Accept order
. This way define all allowed state transitions (create state machine transitions). - Once you are done create a new state machine event of type
StateTransition
and fill-inCreated
as aNewState
andAccepted
as anOldState
. And as anAction
fill-in a sequential workflow which will generate an invoice (.rovided that you created such a workflow before). - Define set of parameter (right click on your newly created event and select
New > Parameter Mapping
) to pass them to the workflow - possiblyid
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.