Labor Pricing Calculation with Work Order Assigned Pricebook
The code snippet Code011: Advanced Get Price can retrieve pricing from a specified Service Pricebook that is defined via a custom field on the Work Order. This extends the existing Get Price logic, which previously could only use the org-wide service Pricebook if no Service Contract with a service Pricebook was associated with the Work Order. With this enhancement, labor pricing can now be generated based on a custom lookup field on the Work Order record, where a service Pricebook is defined.
Code011 Labor Pricing Evaluation
When a Work Detail line is Line Type = Labor and the Work Order includes a Work Plan Assignment (WPA) that is entitled by a Service Contract, Code011 determines the billable labor amount using the applicable Service Pricebook and the coverage rules defined in the Covered Work Plan.
From the Work Detail line, Code011 retrieves:
Work Plan (via the WPA)
Part
Activity Type
The global setting SET019 identifies the Service Pricebook group used for evaluating labor pricing.
Selecting the Service Pricebook
Code011 identifies the Service Pricebook using the following precedence:
1. Service Contract Pricebook: Used when a pricebook is defined on the Service Contract.
2. Work Order Custom Pricebook: If the Service Contract does not define a pricebook, Code011 uses the Service Pricebook selected on the Work Order. This lookup is configured through SET022.
3. Default Labor Pricebook: If neither the Service Contract nor the Work Order provides a pricebook, Code011 uses the default labor pricebook defined in SET017.
Determining the Labor Unit Price
After selecting the Service Pricebook, Code011 searches for a matching unit price in the following order:
1. Work Plan + Part
2. Work Plan
3. Activity + Part
4. Activity
The first matching entry found in this sequence is used as the labor unit price.
Applying Work Plan Coverage
If the labor line is entitled by a Work Plan Assignment, Code011 retrieves the Labor Coverage % from the Covered Work Plan and applies it to the unit price.
Final Billable Price = Unit Price × (100% − Labor Coverage %)
* 
When the Work Detail line is entitled by a Work Plan Assignment (WPA), the included service coverage % will not be applied. Only the Labor Coverage % from the entitled Work Plan is used.
Examples
Example 1: Work Plan price match found
In this scenario, the labor line uses Work Plan associated with the Work plan assignment, and the Service Pricebook contains a price entry that matches the Work Plan.
Code011 searches the Service Pricebook in the sequence: Work Plan & Part → Work Plan → Activity & Part → Activity
A matching Work Plan entry is found first.
Unit Price retrieved: $50
The Covered Work Plan defines Labor Coverage = 90%, meaning the customer is billed for only 10% of the labor cost.
Final Billable Price: $50 × 10% = $5
Example 2: Work Plan + Part price match found
In this scenario, the labor line has Work Plan Assignment and Part populated. The Service Pricebook contains a specific entry that matches Work Plan + Part, which appears earlier in the lookup sequence.
Code011 searches in the required order and finds a match for: Work Plan + Part
Unit Price retrieved from this combined entry: $80
Labor Coverage from the Covered Work Plan remains 90%, so the customer is billed for 10% of the cost.
Final Billable Price: $80 × 10% = $10
Example 3: Falling back to Activity-level pricing
In this scenario, the Service Pricebook does not contain specific matches for the Work Plan + Part combinations.
Code011 searches the pricebook in order:
1. Work Plan + Part → not found
2. Work Plan → not found
3. Activity + Part → not found
4. Activity → found
The Activity-only entry Calibration is found and used as the unit price source.
Unit Price retrieved: $80
Labor Coverage from the Covered Work Plan: 90% (customer pays 10%)
Final Billable Price: $80 × 10% = $8
Configuring the Work Order Pricebook Lookup
To enable this functionality, the administrator must configure a custom field and define a global setting in the ServiceMax Setup.
To enable Get Price for the price book in a custom field on the Work Order:
1. Create a custom service pricebook of the type lookup field in the Work Order object.
* 
You can skip this step if the custom lookup field is already created.
2. Edit the global setting SET022 - Get Price to Acknowledge Custom Lookup for Service Pricebook on WO (Module: Work Order; Sub-Module: Create Work Order Lines VF).
3. Update the setting SET022 with the API name of the custom service pricebook lookup field configured in step 1.
4. Click Save.
Was this helpful?