Step 5: Adding the Postponed Workflow State to the Composite State

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

  1. In the SOInvoiceRepairOrder_Workflow class, add the Postponed workflow 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,
                                                action => action
                                                .IsDuplicatedInToolbar()
                                                .WithConnotation(
                                                    ActionConnotation.Success));
                                        });
                                        });
                                    });
                                });

    In the code above, you have done the following:

    • Added the Postponed workflow state after the CreditHold workflow state
    • Specified that the Postponed workflow state should be skipped if the DiscountEmpty condition is true
    • Added the approveDiscount action to the Postponed workflow state
  2. Save your changes.