ffscpq.AddEstimateProductServiceglobal with sharing class AddEstimateProductService A service that provides functionality related to adding estimate products to estimates. MethodsaddEstimateProductsToEstimatesglobal static List<ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesResponse> addEstimateProductsToEstimates(List<ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequest> requests) A method that adds estimate products to estimates. Input Parameters
Return ValueThis 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';
// You can optionally set the fixed price billing frequency to change from the estimate product default.
request.EstimateProductInstanceFixedPriceBillingFrequency = 'Line Set End Date';
// You can optionally set the fixed price upfront billing percent to change from the estimate product default.
request.EstimateProductInstanceFixedPriceUpfrontBillingPercent = 50;
// 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.IFinalizeEstimateActionglobal interface IFinalizeEstimateAction An action that is executed after all estimate products have been added to an estimate. Methodsexecutevoid execute(Id estimateId) ffscpq.AddEstimateProductService.IFinalizeEstimateProductActionglobal interface IFinalizeEstimateProductAction An action that is executed after the estimate product has been added to the estimate. Methodsexecutevoid execute(ffscpq__Estimate_Product_Instance__c estimateProductInstance) ffscpq.AddEstimateProductService.AddEstimateProductsToEstimatesRequestglobal with sharing class AddEstimateProductsToEstimatesRequest The request structure for adding an estimate product to an estimate. Properties
MethodsAddEstimateProductsToEstimatesRequestglobal AddEstimateProductsToEstimatesRequest(Id estimateId, Id estimateProductId) A default constructor with minimum required properties. Input Parameters
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';
// You can optionally set the fixed price billing frequency to change from the estimate product default.
request.EstimateProductInstanceFixedPriceBillingFrequency = 'Line Set End Date';
// You can optionally set the fixed price upfront billing percent to change from the estimate product default.
request.EstimateProductInstanceFixedPriceUpfrontBillingPercent = 50;
// 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.AddEstimateProductsToEstimatesResponseglobal with sharing class AddEstimateProductsToEstimatesResponse The result returned after adding an estimate product to an estimate. Properties
ffscpq.AddEstimateProductService.AddEstimateProductErrorglobal with sharing class AddEstimateProductError The error that occurred while processing the request. Properties
|