Services CPQ API Developer Reference

ffscpq.AddFromEstimateTemplateService

global with sharing class AddFromEstimateTemplateService

A service that provides functionality related to copying all related records from one estimate to another.

Methods

addAllRelatedRecords

global static List<ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsResponse> addAllRelatedRecords(List<ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsRequest> requests)

A method that copies all related records from an estimate.

Input Parameters

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

Return Value

This service returns AddAllRelatedRecordsResponse 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 copy records from.
Id sourceEstimateId = 'a6CF20000007Z1ZeAQ';

// The ID of the estimate that you want to copy records to.
Id destinationEstimateId = 'a6C320000007Z1eEaA';

// Construct the request
ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsRequest request = new ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsRequest(
    sourceEstimateId,
    destinationEstimateId
);

// You can optionally set this to false if you dont want to copy skills.
request.IncludeSkills = false;

// You can optionally set the StartDate if you dont want to offset the start date of copied records relative to target estimate start date.
request.StartDate = Date.newInstance(2023, 1, 1);

// You can optionally set the EndDate if you dont want to offset the end date of copied records relative to template estimate end date.
request.EndDate = Date.newInstance(2023, 2, 1);

List<ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsResponse> responses = ffscpq.AddFromEstimateTemplateService.addAllRelatedRecords(
    new List<ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsRequest>{ request }
);

// Extract the jobId
System.debug(
    'The jobId for copying all related records from source estimate ' +
    responses[0].SourceEstimateId +
    ' to destination estimate ' +
    responses[0].DestinationEstimateId +
    ': ' +
    responses[0].JobId
);

// Extract errors
System.debug('Number of errors: ' + responses[0].Errors.size());

ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsRequest

global with sharing class AddAllRelatedRecordsRequest

The request structure for copying all related records from an estimate.

Properties

Name Type Description
SourceEstimateId Id The estimate to copy related records from.
DestinationEstimateId Id The estimate to copy related records to.
StartDate Date [Optional] The start date of the copied records will be offset relative to this date instead of target estimate start date. You can't specify a start date if you've specified an end date.
EndDate Date [Optional] The end date of the copied records will be offset relative to this date. You can't specify an end date if you've specified a start date.
IncludeSkills Boolean If true, skills are copied from the existing estimate to the new estimate. The default value is true.

Methods

AddAllRelatedRecordsRequest

global AddAllRelatedRecordsRequest(Id sourceEstimateId, Id destinationEstimateId)

A default constructor with minimum required properties.

Input Parameters

Name Type Description
sourceEstimateId Id The ID of the source estimate.
destinationEstimateId Id The ID of the target estimate.

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 copy records from.
Id sourceEstimateId = 'a6CF20000007Z1ZeAQ';

// The ID of the estimate that you want to copy records to.
Id destinationEstimateId = 'a6C320000007Z1eEaA';

// Construct the request
ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsRequest request = new ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsRequest(
    sourceEstimateId,
    destinationEstimateId
);

// You can optionally set this to false if you dont want to copy skills.
request.IncludeSkills = false;

// You can optionally set the StartDate if you dont want to offset the start date of copied records relative to target estimate start date.
request.StartDate = Date.newInstance(2023, 1, 1);

// You can optionally set the EndDate if you dont want to offset the end date of copied records relative to template estimate end date.
request.EndDate = Date.newInstance(2023, 2, 1);

ffscpq.AddFromEstimateTemplateService.AddAllRelatedRecordsResponse

global with sharing class AddAllRelatedRecordsResponse

The result returned after copying all related record from an estimate.

Properties

Name Type Description
SourceEstimateId Id The estimate that related records were copied from.
DestinationEstimateId Id The estimate that related records were copied to.
JobId Id The AsyncApexJob ID. If this is null, the request was not processed due to an error.
Errors List<ffscpq.AddFromEstimateTemplateService.AddFromEstimateTemplateError> A list containing errors that occurred while processing the request.

ffscpq.AddFromEstimateTemplateService.AddFromEstimateTemplateError

global with sharing class AddFromEstimateTemplateError

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.