Services Estimator API Developer Reference

ffscpq.ConfigurablePricingPlugin

global with sharing class ConfigurablePricingPlugin

A class that contains plugins for configurable pricing.

ffscpq.ConfigurablePricingPlugin.AbstractConfigurablePricingPlugin

global with sharing abstract class AbstractConfigurablePricingPlugin

Provides an extension point for creating plugins to be executed when configuring pricing.
To set up a plugin, create an Estimate Pricing Method record with an Apex Plugin Class Name that matches an Apex class that extends ffscpq.ConfigurablePricingPlugin.AbstractConfigurablePricingPlugin.
The code snippet below demonstrates a plugin implementation for configuring the pricing of role requests.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

/**
 * This pricing plugin sets the Net_Bill_Amount__c field on Estimate Product Instance or
 * the Bill_Amount_Independent_Records__c field on Estimate to 10,000 and distributes the value
 * evenly across all child role requests.
 */
global with sharing class SimpleFixedPricingPlugin extends ffscpq.ConfigurablePricingPlugin.AbstractConfigurablePricingPlugin {
    private static final Decimal FIXED_TOTAL_AMOUNT = 10000;

    global SimpleFixedPricingPlugin() {
    }

    global override List<ffscpq.ConfigurablePricingPlugin.Response> calculate(
        List<ffscpq.ConfigurablePricingPlugin.Request> requests
    ) {
        List<ffscpq.ConfigurablePricingPlugin.Response> responses = new List<ffscpq.ConfigurablePricingPlugin.Response>();

        for (ffscpq.ConfigurablePricingPlugin.Request request : requests) {
            ffscpq.ConfigurablePricingPlugin.Response response = new ffscpq.ConfigurablePricingPlugin.Response();

            List<ffscpq__Estimate_Role_Request__c> roleRequests = request.getRoleRequests();

            if (roleRequests == null || roleRequests.isEmpty()) {
                response.setRoleRequestBillAmounts(new List<Decimal>());
                responses.add(response);
                continue;
            }

            // Calculate amount per role request
            Integer numberOfRoleRequests = roleRequests.size();
            Decimal amountPerRoleRequest = FIXED_TOTAL_AMOUNT / numberOfRoleRequests;

            // Create list of bill amounts (same amount for each role request)
            List<Decimal> billAmounts = new List<Decimal>();
            for (Integer i = 0; i < numberOfRoleRequests; i++) {
                billAmounts.add(amountPerRoleRequest);
            }

            response.setRoleRequestBillAmounts(billAmounts);
            responses.add(response);
        }

        return responses;
    }

    global override List<ffscpq.ConfigurablePricingPlugin.PricingFieldWrapper> getPricingFields() {
        // No fields affect this calculation since we always return 10,000
        return new List<ffscpq.ConfigurablePricingPlugin.PricingFieldWrapper>();
    }
}

Methods

calculate

global abstract List<ffscpq.ConfigurablePricingPlugin.Response> calculate(List<ffscpq.ConfigurablePricingPlugin.Request> requests)

Abstract method to be implemented by subclasses for calculating pricing logic. This is called once per transaction and groups each estimate product instance and independent records into a single request.

Input Parameters

Name Type Description
requests List<ffscpq.ConfigurablePricingPlugin.Request> List of ConfigurablePricingPlugin.Request.

Return Value

List of pricing ConfigurablePricingPlugin.Response.

getPricingFields

global virtual List<ffscpq.ConfigurablePricingPlugin.PricingFieldWrapper> getPricingFields()

Returns the list of fields that when edited, trigger price recalculation. By default, it returns an empty list. Plugins can override this method to specify relevant fields.

Return Value

List of ConfigurablePricingPlugin.PricingFieldWrapper.

ffscpq.ConfigurablePricingPlugin.IConfigurablePricingPlugin

global interface IConfigurablePricingPlugin

Deprecated: see ConfigurablePricingPlugin.AbstractConfigurablePricingPlugin

Methods

calculate

List<ConfigurablePricingPlugin.Response> calculate(List<ffscpq.ConfigurablePricingPlugin.Request> requests)

ffscpq.ConfigurablePricingPlugin.Request

global with sharing class Request

The request structure for configuring the pricing of estimate records.

Methods

getRoleRequests

global List<ffscpq__Estimate_Role_Request__c> getRoleRequests()

Returns the list of all the role requests on the associated estimate product instance or of all the associated role requests independent of estimate products to be configured by the plugin.

ffscpq.ConfigurablePricingPlugin.Response

global with sharing class Response

The response structure for configuring the pricing of the estimate records.

Methods

Response

global Response()

setRoleRequestBillAmounts

global void setRoleRequestBillAmounts(List<Decimal> roleRequestBillAmounts)

Sets the bill amounts on the corresponding role requests provided in the request.

Input Parameters

Name Type Description
roleRequestBillAmounts List<Decimal> The list of bill amounts to be set on the corresponding role requests provided in the request.

ffscpq.ConfigurablePricingPlugin.PricingFieldWrapper

global with sharing class PricingFieldWrapper

A fields class used to specify an SObject type and the set of related required fields for configuring pricing.

Properties

Name Type Description
objectType SObjectType The type of SObject containing the specified fields.
fields Set<SObjectField> The set of required fields from the SObject needed for pricing calculations.

Methods

PricingFieldWrapper

global PricingFieldWrapper()

Creates an empty PricingFieldWrapper object.

PricingFieldWrapper

global PricingFieldWrapper(SObjectType objectType, Set<SObjectField> fields)

Initializes a PricingFieldWrapper with the SObject type and fields required for pricing calculations.

Input Parameters

Name Type Description
objectType SObjectType The type of SObject containing the specified fields.
fields Set<SObjectField> The set of required fields from the SObject needed for pricing calculations.
© Copyright 2009–2026 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.