Services CPQ API Developer Reference

ffscpq.AddEstimateProductService

global with sharing class AddEstimateProductService

A service that provides functionality related to adding estimate products to estimates.

Methods

addEstimateProductsToEstimates

global static List<ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesResponse> addEstimateProductsToEstimates(List<ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequest> requests)

A method that adds estimate products to estimates.

Input Parameters

Name Type Description
requests List<ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequest> The list of AddEstimateProductsToEstimatesRequest. The number of unique target estimates cannot exceed 50 within all requests.

Return Value

This service returns AddEstimateProductsToEstimatesResponse in a list that parallels the input list.

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.

// The ID of the estimate that you want to add the estimate product to.
Id estimateId = 'a6MDK000000L2fJ2AS';

// The ID of the estimate product that you want to add to the estimate.
Id estimateProductId = 'a6HDK000000L2uu2AC';

// Construct the request
ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequest request = new ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequest(
    estimateId,
    estimateProductId
);

// You can optionally set the billing type to change from the estimate product default.
request.EstimateProductInstanceBillingType = 'Fixed Price';

// If billing type is specified as Fixed Price or you want to change from the default fixed price margin, you can set it here.
request.EstimateProductInstanceFixedPriceMargin = 15;

// You can optionally set the name of the created estimate product instance.
request.Name = 'Delivery & Support';

// You can optionally set the start date of the created estimate product instance if you want it offset from the target estimate start date.
request.StartDate = Date.newInstance(2023, 1, 1);

// You can optionally specify object fields to override for the copied records.
Id unitedStatesRegion = 'a2y7i000003396bAAA';
request.FieldOverridesByType = new Map<SObjectType, Map<SObjectField, Object>>{
    ffscpq__Estimate_Role_Request__c.SObjectType => new Map<SObjectField, Object>{
        // Set the region for all copied role requests to the United States region.
        ffscpq__Estimate_Role_Request__c.ffscpq__Region__c => unitedStatesRegion
    }
};

List<ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesResponse> responses = ffscpq.AddEstimateProductService.addEstimateProductsToEstimates(
    new List<ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequest>{ request }
);

// Extract the response data
System.debug('The estimate product ID: ' + responses[0].EstimateProductId);
System.debug('The destination estimate ID: ' + responses[0].EstimateId);
System.debug('The ApexJobId: ' + responses[0].JobId);

// Extract errors
System.debug('Number of errors: ' + responses[0].Errors.size());
if (!responses[0].Errors.isEmpty()) {
    System.debug('Error message: ' + responses[0].Errors[0].Message);
}

ffscpq.AddEstimateProductService.IFinalizeEstimateAction

global interface IFinalizeEstimateAction

An action that is executed after all estimate products have been added to an estimate.

Methods

execute

void execute(Id estimateId)

ffscpq.AddEstimateProductService.IFinalizeEstimateProductAction

global interface IFinalizeEstimateProductAction

An action that is executed after the estimate product has been added to the estimate.

Methods

execute

void execute(ffscpq__Estimate_Product_Instance__c estimateProductInstance)

ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequest

global with sharing class AddEstimateProductsToEstimatesRequest

The request structure for adding an estimate product to an estimate.

Properties

Name Type Description
EstimateId Id The estimate to copy the estimate product to.
EstimateProductId Id The estimate product to be copied.
EstimateProductInstanceBillingType String [Optional] The billing type for the copied estimate product instance. Must be 'Fixed Price' or 'Time and Materials'. If this is not provided the estimate product's default billing type is used.
EstimateProductInstanceFixedPriceMargin Decimal [Optional] The fixed price margin for the copied estimate product instance. If the billing type is specified as 'Fixed Price', this parameter is mandatory. If the billing type is specified as 'Time and Materials' or is not provided, this parameter is not used.
Name String [Optional] The name for the copied estimate product instance. If this is not provided the estimate product's name is used.
StartDate Date [Optional] The start date of the copied estimate product instance will be offset relative to this date. If this is not provided the estimate's start date is used.
FinalizeEstimateAction ffscpq.AddEstimateProductService.IFinalizeEstimateAction [Optional] An action to be executed after all estimate products have been added to an estimate.
FinalizeAction ffscpq.AddEstimateProductService.IFinalizeEstimateProductAction [Optional] An action to be executed after the estimate product has been added to the estimate.
FieldOverridesByType Map<SObjectType, Map<SObjectField, Object>> [Optional] The specified object fields will be overridden to the supplied values. Supported Objects: ffscpq__Estimate_Line_Set__c ffscpq__Estimate_Task__c ffscpq__Estimate_Role_Request__c ffscpq__Estimated_Expense__c ffscpq__Estimate_Vendor_Line_Item__c ffscpq__Estimate_Role_Skill_Request__c
--- Unsupported Fields: CurrencyIsoCode ffscpq__Start_Date__c ffscpq__End_Date__c Hierarchy Lookups (for example, ffscpq__Estimate_Task__c.ffscpq__Estimate__c) Rollup fields on records (for example, ffscpq__Net_Bill_Amount__c, ffscpq__Cost_Amount__c, ffscpq__Bill_Amount__c), except additional cost rollups, such as estimated expense amounts

Methods

AddEstimateProductsToEstimatesRequest

global AddEstimateProductsToEstimatesRequest(Id estimateId, Id estimateProductId)

A default constructor with minimum required properties.

Input Parameters

Name Type Description
estimateId Id The ID of the estimate.
estimateProductId Id The ID of the estimate product.

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.

// The ID of the estimate that you want to add the estimate product to.
Id estimateId = 'a6MDK000000L2fJ2AS';

// The ID of the estimate product that you want to add to the estimate.
Id estimateProductId = 'a6HDK000000L2uu2AC';

// Construct the request
ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequest request = new ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequest(
    estimateId,
    estimateProductId
);

// You can optionally set the billing type to change from the estimate product default.
request.EstimateProductInstanceBillingType = 'Fixed Price';

// If billing type is specified as Fixed Price or you want to change from the default fixed price margin, you can set it here.
request.EstimateProductInstanceFixedPriceMargin = 15;

// You can optionally set the name of the created estimate product instance.
request.Name = 'Delivery & Support';

// You can optionally set the start date of the created estimate product instance if you want it offset from the target estimate start date.
request.StartDate = Date.newInstance(2023, 1, 1);

// You can optionally specify object fields to override for the copied records.
Id unitedStatesRegion = 'a2y7i000003396bAAA';
request.FieldOverridesByType = new Map<SObjectType, Map<SObjectField, Object>>{
    ffscpq__Estimate_Role_Request__c.SObjectType => new Map<SObjectField, Object>{
        // Set the region for all copied role requests to the United States region.
        ffscpq__Estimate_Role_Request__c.ffscpq__Region__c => unitedStatesRegion
    }
};

ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesResponse

global with sharing class AddEstimateProductsToEstimatesResponse

The result returned after adding an estimate product to an estimate.

Properties

Name Type Description
EstimateProductId Id The estimate product that was added.
EstimateId Id The estimate which the estimate product was added to.
JobId Id The AsyncApexJob Id.
Errors List<ffscpq.AddEstimateProductService.AddEstimateProductError> A list containing errors that occurred while processing the request.

ffscpq.AddEstimateProductService.AddEstimateProductError

global with sharing class AddEstimateProductError

The error that occurred while processing the request.

Properties

Name Type Description
Message String The error message.
© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.