Step 1: Adding and Configuring the Action
In this step, you will add the Complete action in the graph of the Repair
Work Orders (RS301000) form and in the screen configuration of this form. You will specify
the location of the associated command by using the WithCategory method
and assign the DAC field values by using the WithFieldAssignments
method.
Do the following:
- In the
RSSVWorkOrderEntrygraph, declare theCompleteaction, as the following code shows.public PXAction<RSSVWorkOrder> Complete = null!; [PXButton] [PXUIField(DisplayName = "Complete", Enabled = false)] protected virtual IEnumerable complete(PXAdapter adapter) => adapter.Get(); - In the
RSSVWorkOrderEntry_Workflowclass, add theCompleteaction in the lambda expression for the WithActions method, as the following code shows.actions.Add(graph => graph.Complete, action => action .WithCategory(processingCategory, Placement.Last) .WithFieldAssignments(fields => fields .Add<RSSVWorkOrder.dateCompleted>(field => field.SetFromToday())));In the code above, you have defined the
Completeaction in the screen configuration. In the WithCategory method, you have specified that the associated command will be displayed last in the Processing category of the More menu by specifying the Placement.Last parameter. Also, in the WithFieldAssignments method, by calling the SetFromToday method, you have specified that theRSSVWorkOrder.dateCompletedfield is assigned the current business date. - To make the
Completeaction available in theAssignedworkflow state, add the action to the configuration of theAssignedworkflow state in the GetAssignedBehavior private static method, as the following code shows..WithActions(actions => { actions.Add(graph => graph.Complete, action => action .IsDuplicatedInToolbar() .WithConnotation(ActionConnotation.Success)); });
