Step 5: Add the Postponed State to the Composite State

To add the Postponed state to the composite state, do the following:

  1. In the SOInvoiceOrder_Workflow class, locate the WithFlowStates method call or add it if it is not yet present in your code.
  2. Add the Postponed state in the WithFlowStates method, as shown in the following code.
    flowStates.UpdateSequence<ARDocStatus.HoldToBalance>(seq =>
    {
        return seq.WithStates(states =>
        {
            states.Add<ARDocStatus_Postponed.postponed>(flowState =>
            {
                return flowState
                    .PlaceAfter<ARDocStatus.creditHold>()
                    .IsSkippedWhen(conditions.DiscountEmpty)
                    .WithActions(actions =>
                    {
                        actions.Add(approveDiscount, a => a
                          .IsDuplicatedInToolbar()
                          .WithConnotation(ActionConnotation.Success));
                    });
            });
        });
    });

    In the code above, you have added the Postponed state after the CreditHold state, specified that the Postponed state should be skipped if the DiscountEmpty condition is true, and added the approveDiscount action to the Postponed state.