Services Estimator API Developer Reference

ffscpq.PushToOpportunityService

global with sharing class PushToOpportunityService

Deprecated: see AddToOpportunityFromEstimateService

Methods

pushToOpportunity

Deprecated: see AddToOpportunityFromEstimateService.addToOpportunitiesFromEstimatesAsync.

global static List<ffscpq.PushToOpportunityService.PushToOpportunityResponse> pushToOpportunity(List<ffscpq.PushToOpportunityService.PushToOpportunityRequest> requests)

Input Parameters

Name Type Description
requests List<ffscpq.PushToOpportunityService.PushToOpportunityRequest> The list of PushToOpportunityRequest objects.

Return Value

This service returns PushToOpportunityResponse 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 contains the details you want to push to the related opportunity. A request is required for each estimate you want to push.
Id estimateId = 'a6B5C0000004VrnUAE';

// Provide the request with the estimate product IDs that you want to push details from. If you want to push all of the estimate products, you can select them all as shown in this example.
List<ffscpq__Estimate_Product_Instance__c> estimateProductInstances = [
    SELECT Id
    FROM ffscpq__Estimate_Product_Instance__c
    WHERE ffscpq__Estimate__c = :estimateId
];
Set<Id> estimateProductInstanceIds = new Map<Id, ffscpq__Estimate_Product_Instance__c>(
        estimateProductInstances
    )
    .keySet();

// Construct the request.
ffscpq.PushToOpportunityService.PushToOpportunityRequest request = new ffscpq.PushToOpportunityService.PushToOpportunityRequest(
    estimateId
);
request.EstimateProductIds = estimateProductInstanceIds;

// This is an optional setting that provides additional fields to consolidate estimate role requests by when generating resource requests.
request.AdditionalAggregationFields = new Set<SObjectField>{
    ffscpq__Estimate_Role_Request__c.ffscpq__Test__c
};

// You can set this to false if you don't want to consolidate estimate role requests by skills when generating resource requests.
request.AggregateBySkills = false;

//  You can set details for the product used to represent estimate records that are independent of estimate products.
request.ProductId = '01t5C000006gCveQAE';
request.ProductDate = Date.today();
request.ProductDescription = 'A description';

ffscpq.PushToOpportunityService.pushToOpportunity(
    new List<ffscpq.PushToOpportunityService.PushToOpportunityRequest>{ request }
);

ffscpq.PushToOpportunityService.PushToOpportunityRequest

global with sharing class PushToOpportunityRequest

The request structure for adding an estimate to its related opportunity.

Properties

Name Type Description
EstimateId Id The ID of the estimate being added to opportunity.
EstimateProductIds Set<Id> A set of IDs of the estimate product instances to be added to opportunity.
IncludeRecordsIndependentOfEstimateProducts Boolean If true, records independent of estimate products will be added to opportunity.
AdditionalAggregationFields Set<SObjectField> DEPRECATED. This property will become obsolete in a future release. creating resource requests.
AdditionalAggregationFieldPaths List<String> [Optional] Additional fields to consolidate estimate role requests by when creating resource requests.
AggregateBySkills Boolean If true, role requests are consolidated by skills. The default value is false.
CreateOpportunityLineItems Boolean If true, opportunity products are created for each estimate product instance. The default value is true.
ProductId Id The ID of the product used to represent records that are independent of estimate products.
ProductDate Date The date of the opportunity product used to represent records that are independent of estimate products.
ProductDescription String The description of the opportunity product used to represent records that are independent of estimate products.

Methods

PushToOpportunityRequest

global PushToOpportunityRequest(Id estimateId)

A default constructor with minimum required properties.

Input Parameters

Name Type Description
estimateId Id The estimate ID.

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 contains the details you want to push to the related opportunity. A request is required for each estimate you want to push.
Id estimateId = 'a6B5C0000004VrnUAE';

// Provide the request with the estimate product IDs that you want to push details from. If you want to push all of the estimate products, you can select them all as shown in this example.
List<ffscpq__Estimate_Product_Instance__c> estimateProductInstances = [
    SELECT Id
    FROM ffscpq__Estimate_Product_Instance__c
    WHERE ffscpq__Estimate__c = :estimateId
];
Set<Id> estimateProductInstanceIds = new Map<Id, ffscpq__Estimate_Product_Instance__c>(
        estimateProductInstances
    )
    .keySet();

// Construct the request.
ffscpq.PushToOpportunityService.PushToOpportunityRequest request = new ffscpq.PushToOpportunityService.PushToOpportunityRequest(
    estimateId
);
request.EstimateProductIds = estimateProductInstanceIds;

// This is an optional setting that provides additional fields to consolidate estimate role requests by when generating resource requests.
request.AdditionalAggregationFields = new Set<SObjectField>{
    ffscpq__Estimate_Role_Request__c.ffscpq__Test__c
};

// You can set this to false if you don't want to consolidate estimate role requests by skills when generating resource requests.
request.AggregateBySkills = false;

//  You can set details for the product used to represent estimate records that are independent of estimate products.
request.ProductId = '01t5C000006gCveQAE';
request.ProductDate = Date.today();
request.ProductDescription = 'A description';

ffscpq.PushToOpportunityService.PushToOpportunityResponse

global with sharing class PushToOpportunityResponse

The response structure for adding an estimate to its related opportunity.

Properties

Name Type Description
estimateId Id The estimate ID.
errors List<ffscpq.PushToOpportunityService.PushToOpportunityError> A list containing errors that occurred while processing the request.

ffscpq.PushToOpportunityService.PushToOpportunityError

global with sharing class PushToOpportunityError

The error that occurred while processing the request.

Properties

Name Type Description
recordId Id The ID of the record.
message String The error message.
© Copyright 2009–2024 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.