ffscpq.PushToOpportunityServiceglobal with sharing class PushToOpportunityService A service that provides functionality related to pushing details from estimates to their related opportunities. MethodspushToOpportunityglobal static List<ffscpq.PushToOpportunityService.PushToOpportunityResponse> pushToOpportunity(List<ffscpq.PushToOpportunityService.PushToOpportunityRequest> requests) A method that pushes estimate details to their related opportunities by by creating resource requests and opportunity products. Input Parameters
Return ValueThis 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.PushToOpportunityRequestglobal with sharing class PushToOpportunityRequest The request structure for pushing an estimate to its related opportunity. Properties
MethodsPushToOpportunityRequestglobal PushToOpportunityRequest(Id estimateId) 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 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.PushToOpportunityResponseglobal with sharing class PushToOpportunityResponse The response structure for pushing an estimate to its related opportunity. |