Step 1: Implementing the Action in the Graph

In this step, you will implement the ReleaseFromHold action to the RSSVWorkOrderEntry graph.

To add a workflow action, you should perform the following tasks:

  1. Define the workflow action in a graph.

    You will add this definition in the current step.

  2. Register this action configuration in the screen configuration. You do this by calling the WithActions method in the AddScreenConfigurationFor method.

    You will perform this task in Step 3: Adding the Action to the Workflow.

Defining the ReleaseFromHold Action

To define the ReleaseFromHold action in the RSSVWorkOrderEntry graph, do the following:

  1. Add the using System.Collections; directive to the RSSVWorkOrderEntry.cs file (if it has not been added yet). Then, add the Actions region.
  2. In the Actions region, add the following code.
            #region Actions
            public PXAction<RSSVWorkOrder> ReleaseFromHold;
            [PXButton(), PXUIField(DisplayName = "Remove Hold",
              MapEnableRights = PXCacheRights.Select,
              MapViewRights = PXCacheRights.Select)]
            protected virtual IEnumerable releaseFromHold(PXAdapter adapter)
               => adapter.Get();
            #endregion

    In the code above, you have added a field of the PXAction<> type and the method that implements the action. The method is empty because the business logic behind the action will be described in the code of the workflow.

    The action method is decorated with the PXButton attribute, where you specify the display name of the action and the cache access rights.

  3. Save your changes.