Step 4: Add the Skip Condition

The Postponed state can be skipped if no discount is being applied to the invoice—that is, if the Document Discounts box is empty on the Invoices (SO303000) form. In this step, you will define this condition by doing the following:

  1. On the Invoices form, learn the field name of the Document Discounts box by using the Element Inspector. The field name is CuryDiscTot, and the field is defined in the ARInvoice DAC.
  2. In Visual Studio, open the definition of the ARInvoice DAC, which is located in the App_Data/CodeRepository/PX.Objects/AR/DAC folder, and find out which field is the key field. It is refNbr.
  3. In the SOInvoiceOrder_Workflow class, define the condition, as the following code shows.
            #region Conditions
            public class Conditions : Condition.Pack
            {
                public Condition DiscountEmpty => GetOrCreate(b =>
                  b.FromBql<ARInvoice.curyDiscTot.IsEqual<decimal0>>());
            }
            #endregion
  4. Add the necessary using directive, as the following code shows. Also, add the using PX.Objects.CS; directive, if it has not been added already.
    using static PX.Data.WorkflowAPI.BoundedTo<PX.Objects.SO.SOInvoiceEntry,
      PX.Objects.AR.ARInvoice>;
  5. Create an instance of the Conditions class in the Configure method, as the following code shows.
                var conditions = context.Conditions.GetPack<Conditions>();