ffscpq.AddToProjectFromEstimatePluginglobal with sharing class AddToProjectFromEstimatePlugin A class that contains plugins to use after the Add to Existing Project action has been completed. ffscpq.AddToProjectFromEstimatePlugin.IAddToProjectFromEstimatePluginglobal interface IAddToProjectFromEstimatePlugin Provides an interface that can be used to create plugins to be executed after the Add to Existing Project action is complete. This enables the custom Apex classes to be executed. To set up a plugin, create a fferpcore__Plugin__mdt record with a fferpcore__ExtensionPoint__c of AddToProjectFromEstimatePlugin.IAddToProjectFromEstimatePlugin, and a ClassName that matches an Apex class which implements that interface. 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. /** * This Add to Project From Estimate plugin uses the Add_From_Estimate_Timestamp__c custom date/time field on the Project object. * It indicates the most recent time that records were added to a project from an estimate. */ public with sharing class AddToProjectTimestampPlugin implements ffscpq.AddToProjectFromEstimatePlugin.IAddToProjectFromEstimatePlugin { public ffscpq.AddToProjectFromEstimatePlugin.Response executePlugin( ffscpq.AddToProjectFromEstimatePlugin.Request request ) { /** * The resulting data is retrieved from the estimate product instances used in the Add to Existing Project action which executed this plugin. * // The IDs of the estimates related to these estimate product instances are then stored in a set. */ List<ffscpq.AddToProjectFromEstimatePlugin.Result> results = request.getResults(); Set<Id> projectIds = new Set<Id>(); for (ffscpq.AddToProjectFromEstimatePlugin.Result result : results) { // Only the data of successfully processed estimate product instances are used. if (result.getStatus() == ffscpq.EstimateActionStatus.SUCCESSFUL) { projectIds.add(result.getProjectId()); } } // The IDs of the estimates related to these estimate product instances are then stored in a set. List<pse__Proj__c> projects = [ SELECT Id, Add_From_Estimate_Timestamp__c FROM pse__Proj__c WHERE Id IN :projectIds ]; for (pse__Proj__c project : projects) { project.Add_From_Estimate_Timestamp__c = Datetime.now(); } update projects; // Create the response. return buildResponse(request); } private ffscpq.AddToProjectFromEstimatePlugin.Response buildResponse( ffscpq.AddToProjectFromEstimatePlugin.Request request ) { ffscpq.AddToProjectFromEstimatePlugin.Response response = new ffscpq.AddToProjectFromEstimatePlugin.Response(); response.setRequest(request); return response; } } MethodsexecutePluginResponse executePlugin(ffscpq.AddToProjectFromEstimatePlugin.Request request) A method that executes this plugin implementation. Input Parameters
Return ValueA response that parallels the request. ffscpq.AddToProjectFromEstimatePlugin.Requestglobal with sharing class Request The request structure for executing the plugin. Methods
getResultsglobal List<ffscpq.AddToProjectFromEstimatePlugin.Result> getResults() Retrieves a list that contains the response data of the estimate product instances used in the Add to Existing Project action that triggered this plugin. Return ValueA list of Results. getAdditionalAggregationFieldPathsglobal List<String> getAdditionalAggregationFieldPaths() Retrieves a string field path of additional fields used to consolidate role requests when creating resource requests. Return ValueA list of String field paths used in role request consolidation. isAggregatedBySkillsglobal Boolean isAggregatedBySkills() Indicates whether the role requests that were added to the associated project were consolidated by skills. Return ValueA boolean to indicate if role requests were consolidated by skills. ffscpq.AddToProjectFromEstimatePlugin.Resultglobal with sharing class Result Result containing data of the estimate product instance used in the Add to Existing Project action that executes this plugin. Methods
getEstimateIdglobal Id getEstimateId() The ID of the estimate used in the Add to Existing Project action which executed this plugin. Return ValueThe ID of the estimate associated with the estimate product instances. getEstimateProductInstanceIdglobal Id getEstimateProductInstanceId() The ID of the estimate product instance used in the Add to Existing Project action which executed this plugin. Return ValueThe ID of the estimate product instance. getProjectIdglobal Id getProjectId() The ID of the project used in the Add to Existing Project action which executed this plugin. Return ValueThe ID of the project that records associated with the estimate product instance were added to. getInternalBudgetIdglobal Id getInternalBudgetId() The ID of the internal budget with non billable expenses associated with the estimate product instances used in the Add to Existing Project action which executed this plugin. Return ValueThe ID of internal budget that was created. getCustomerPurchaseOrderBudgetIdglobal Id getCustomerPurchaseOrderBudgetId() The ID of the customer purchase order budget with billable expenses associated with the estimate product instances used in the Add to Existing Project action which executed this plugin. Return ValueThe ID of the customer purchase order budget that was created. getVendorPurchaseOrderBudgetIdsglobal Set<Id> getVendorPurchaseOrderBudgetIds() A set of IDs of vendor purchase order budgets from the estimate vendor line items associated with the estimate product instances used in the Add to Existing Project action which executed this plugin. Return ValueA set of IDs of the vendor purchase order budgets that were created. getStatusglobal ffscpq.EstimateActionStatus getStatus() The ffscpq.EstimateActionStatus enum that corresponds to the status of the Add to Existing Project action which executed this plugin. Return ValueAn EstimateActionStatus. getErrorsglobal List<ffscpq.AddToProjectFromEstimatePlugin.Error> getErrors() A list containing errors that resulted from the Add to Existing Project action which executed this plugin. Return ValueA list of errors. ffscpq.AddToProjectFromEstimatePlugin.Responseglobal with sharing class Response The response structure for executing the plugin. Methods
Responseglobal Response() setRequestglobal void setRequest(ffscpq.AddToProjectFromEstimatePlugin.Request sourceRequest) Set the source request used by this plugin. Input Parameters
getRequestglobal ffscpq.AddToProjectFromEstimatePlugin.Request getRequest() Retrieves the source request used by this plugin. Return ValueA request. ffscpq.AddToProjectFromEstimatePlugin.Errorglobal with sharing class Error The structure of the errors that occurred during the Add to Existing Project action which executed this plugin. MethodsgetMessageglobal String getMessage() The message of the error that occured during the Add to Existing Project action which executed this plugin. Return ValueA string error message. |