ffbc.PlansServiceglobal with sharing class PlansService This class provides service functionality for the Plan object. EnumsStatusAn enum that represents the valid options for the status of plans.
Methods
addToContractsglobal static Set<Id> addToContracts(List<ffbc.PlansService.ContractAddition> additions) Creates new contract line items from plans. Input Parameters
Exceptions Thrown
Return ValueThe IDs of the contract line items that were created. addToUnsavedContractsglobal static ffbc.PlansService.AddToUnsavedContractsResult addToUnsavedContracts(List<ffbc.PlansService.UnsavedContractAddition> additions) Creates new contract line items from plans, and returns the new lines without inserting them. The contracts being added to do not need to have been saved to the database yet. The lines created by this are of the type used by ContractsService.Contract. For example, this can be used when constructing a contract to send to ContractsService.save or ContractsService.saveNewChangeRequest. Input Parameters
Exceptions Thrown
Return ValueA response containing results for each contract, mapped by the unique ID specified for that contract in the request. 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 example shows how you can combine ffbc.PlansService.addToUnsavedContracts with methods from the Contracts * service to create a change request to upsell a contract with two plans. */ //These parameters would specify the contract which is being upsold, and the two plans to be added to it. Id contractId; Id planId1; Id planId2; //Create the change request without saving it to the database. ffbc.ContractsService.Contract changeRequest = ffbc.ContractsService.createChangeRequestObject(contractId); //Create the request from the contract data. ffbc.PlansService.UnsavedContractAddition additionRequest = new ffbc.PlansService.UnsavedContractAddition(); additionRequest.UniqueId = contractId; additionRequest.ContractStartDate = changeRequest.StartDate; additionRequest.ContractEndDate = changeRequest.EndDate; additionRequest.ContractFirstBillDate = changeRequest.FirstBillDate; additionRequest.ContractCurrencyIsoCode = changeRequest.CurrencyIsoCode; additionRequest.ContractName = changeRequest.ContractName; //Create the requests to add the desired plans. ffbc.PlansService.PlanToAdd planAddition1 = new ffbc.PlansService.PlanToAdd(planId1); additionRequest.PlansToAdd.add(planAddition1); ffbc.PlansService.PlanToAdd planAddition2 = new ffbc.PlansService.PlanToAdd(planId2); additionRequest.PlansToAdd.add(planAddition2); //Get the contract lines which are created as a result of adding these plans to the change request. ffbc.PlansService.AddToUnsavedContractsResult result = ffbc.PlansService.addToUnsavedContracts(new List<ffbc.PlansService.UnsavedContractAddition>{additionRequest}); List<ffbc.ContractsService.ContractLineItem> linesCreated = result.ResultsByUniqueId.get(contractId).LineItems; //Add the lines to the change request and send it back to ffbc.ContractsService.saveNewChangeRequest to be saved on the database. for (ffbc.ContractsService.ContractLineItem line : linesCreated) { changeRequest.addLineItem(line); } ffbc.ContractsService.saveNewChangeRequest(changeRequest); convertToContractsglobal static Set<Id> convertToContracts(List<ffbc.PlansService.ContractConversion> conversions) Creates new contracts from plans. Input Parameters
Exceptions Thrown
Return ValueThe Ids of the created contracts. deletePlansglobal static void deletePlans(Set<Id> planIds) Deletes the plans with the given IDs. Input Parameters
getAllActivePlanSummariesglobal static List<ffbc.PlansService.PlanSummary> getAllActivePlanSummaries() Retrieves a list of summarised Plan details from all active plans. Return ValueA list of summarised active Plans loadglobal static List<ffbc.PlansService.Plan> load(Set<Id> planIds) Retrieves the plans from the IDs provided and returns a wrapper for each plan and its line items. Input Parameters
Return ValueThe wrapper for each plan and its list of line items. saveglobal static Set<Id> save(List<ffbc.PlansService.Plan> plansToSave) Saves new or existing plans and plan line items. Existing plan line items which are not included in the parent plan are deleted. Input Parameters
Exceptions Thrown
Return ValueThe set of IDs of plans that have been saved. ffbc.PlansService.AddToContractResultglobal with sharing class AddToContractResult This class represents the results for a single contract by PlansService.addToUnsavedContracts. All line items which have been created are stored on this object. Properties
ffbc.PlansService.AddToUnsavedContractsResultglobal with sharing class AddToUnsavedContractsResult This class represents the results of a single call to PlansService.addToUnsavedContracts. All results for all plans and contracts are grouped under one of these. Properties
ffbc.PlansService.ContractAdditionglobal with sharing class ContractAddition This class wraps the criteria to be used when adding plans to contracts. Properties
Methodsffbc.PlansService.ContractConversionglobal with sharing class ContractConversion This class sets the data required to convert a plan to a contract. Properties
MethodsContractConversionglobal ContractConversion() The default constructor for a ContractConversion object. ffbc.PlansService.Planglobal with sharing class Plan This class models a plan with plan line items, including fields that are relevant to plan creation, viewing and editing. This class is marked as serializable and deserializable to work around an issue in enforcing JsonAccess for Visualforce remoting requests. Warning: Do not rely on any behavior available via serializing as or deserializing from JSON that is not part of the global API because it might be subject to change. Properties
Methodsffbc.PlansService.PlanLineItemglobal with sharing class PlanLineItem This class models a Plan Line Item, including fields that are relevant to plan creation, viewing and editing. This class is marked as serializable and deserializable to work around an issue in enforcing JsonAccess for Visualforce remoting requests. Warning: Do not rely on any behavior available via serializing as or deserializing from JSON that is not part of the global API because it might be subject to change. Properties
Methodsffbc.PlansService.PlanSummaryglobal with sharing class PlanSummary This class presents a summarised detail of the Plan object This class is marked as serializable and deserializable to work around an issue in enforcing JsonAccess for Visualforce remoting requests. Warning: Do not rely on any behavior available via serializing as or deserializing from JSON that is not part of the global API because it might be subject to change. Properties
ffbc.PlansService.PlanToAddglobal with sharing class PlanToAdd This class represents a plan which is to be added to a contract by PlansService.addToUnsavedContracts. It allows you to specify which plan will be added. Properties
MethodsPlanToAddglobal PlanToAdd(Id planId) Constructs a PlanToAdd for a specific plan. Input Parameters
ffbc.PlansService.UnsavedContractAdditionglobal with sharing class UnsavedContractAddition This class represents a request to add plans to a particular contract, for use in PlansService.addToUnsavedContracts. You can specify fields for the contract which affect how the lines are produced, and a list of plans which are to be added to this contract. Properties
MethodsUnsavedContractAdditionglobal UnsavedContractAddition() Constructs an empty addition. This sets PlansToAdd to an empty list, and ContractCurrencyIsoCode to the default currency for your organisation. If you do not use multiple currencies, this will be the only currency available. |