Step 2: Defining the Action That Opens the Dialog Box

In this step, you will add the Assign action to the RSSVWorkOrderEntry graph and register the action in the screen configuration. Do the following:

  1. In the RSSVWorkOrderEntry graph, define the Assign action, as the following code shows.
            public PXAction<RSSVWorkOrder> Assign;
            [PXButton]
            [PXUIField(DisplayName = "Assign", Enabled = false)]
            protected virtual IEnumerable assign(PXAdapter adapter) => adapter.Get();
  2. In the RSSVWorkOrderWorkflow class, in the lambda expression for the WithActions method at the screen configuration level, add the Assign action, as the following code shows.
                        actions.Add(g => g.Assign, c => c
                          .WithCategory(processingCategory)
                          .WithForm(formAssign)
                          .WithFieldAssignments(fields => {
                          fields.Add<RSSVWorkOrder.assignee>(f =>
                            f.SetFromFormField(formAssign, "Assignee"));
                          }));

    In the code above, you have added the Assign action to the screen configuration. You have specified the name of the dialog box for the action in the WithForm method and the DAC field that should be updated from the dialog box in the WithFieldAssignments method.

  3. Save your changes.