Step 1: Adding a Condition
To implement a transition from the OnHold workflow state to the
ReadyForAssignment or PendingPayment workflow state,
based on the properties of the current repair work order, you need to define a condition
that is true when a repair work order requires prepayment. You will use the logical NOT C#
operator and this condition to define a condition that is true when a repair work order does
not require prepayment.
A repair work order requires prepayment when the service specified for the order requires
prepayment. The service requires prepayment if the Prepayment check
box is selected for the service on the Repair Services (RS201000) form. This means that to
check whether a repair work order requires prepayment, you need to check the value of the
prepayment property of the RSSVRepairService DAC record,
which has the same serviceID value as the repair work order.
To declare the condition, do the following:
- In the
RSSVWorkOrderEntry_Workflowclass, add theConditionsregion. - In the
Conditionsregion, declare a condition class, as the following code shows.public class Conditions : Condition.Pack { } - In the
Conditionsclass, declare a condition that is true when the repair work order requires prepayment, as the following code shows.public Condition RequiresPrepayment => GetOrCreate(condition => condition.FromBql<Where<RSSVRepairService.prepayment .FromSelectorOf<RSSVWorkOrder.serviceID>.IsEqual<True>>>());In the code above, you have created a condition by calling the GetOrCreate method and provided a BQL statement in the lambda expression. In the BQL statement, you have selected the
RSSVRepairServicerecord by using theRSSVWorkOrder.serviceIDvalue and checked whether theRSSVRepairService.prepaymentvalue of this record equals true. - In the static Configure method, create an instance of the
Conditions class, as the following code
shows.
// Create an instance of the Conditions class var conditions = context.Conditions.GetPack<Conditions>(); - Save your changes.
