ffbc.ConsolidationServiceglobal with sharing class ConsolidationService This class provides functionality to perform consolidation of billing documents, add billing documents to an existing consolidated document, and to undo the consolidation of billing documents. You must enable the Billing Document Consolidation feature in Feature Console before using the service. Methods
addBillingDocumentsToConsolidateglobal static ffbc.ConsolidationService.ConsolidationResponse addBillingDocumentsToConsolidate(ffbc.ConsolidationService.AdditionRequest request) Adds billing documents with "Draft" document status to a consolidated billing document with "Draft" document status. The billing documents are valid if their Document Type, Currency, Company, and Account fields have the same value. If DocumentDate and DueDate are supplied, they override the existing values on the consolidated billing document. All other header fields on the consolidated billing document are unchanged. Input Parameters
Return ValueA response containing the results of the AdditionRequest. 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. /** * Example of using addBillingDocumentsToConsolidate() method of ConsolidationService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of additional billing documents to be consolidated, identified by ID. Set<Id> setOfBillingDocuments = New Set<Id> {*billingDocumentIds*} ffbc.ConsolidationService.AdditionRequest request = new ffbc.ConsolidationService.AdditionRequest(setOfBillingDocuments); request.ConsolidatedBillingDocumentId = *consolidatedBillingDocumentId*; //If the DocumentDate is not specified then it will not be changed in the header of the consolidated billing document. request.DocumentDate = *requestDocumentDate*; //If the DueDate is not specified then it will not be changed in the header of the consolidated billing document. request.DueDate = *requestDueDate*; ffbc.ConsolidationService.ConsolidationResponse response = ffbc.ConsolidationService.addBillingDocumentsToConsolidate(request); consolidateglobal static ffbc.ConsolidationService.ConsolidationResponse consolidate(ffbc.ConsolidationService.ConsolidationRequest request) Consolidates the supplied billing documents provided that they are valid and at least two billing documents are in the request. The billing documents are valid if all of the following are true: Input Parameters
Return ValueA response containing the results of the ConsolidationRequest. 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. /** * Example of using consolidate() method of ConsolidationService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of billing documents to be consolidated, identified by ID. Set<Id> setOfBillingDocuments = New Set<Id> {*billingDocumentIds*} ffbc.ConsolidationService.ConsolidationRequest request = new ffbc.ConsolidationService.ConsolidationRequest(setOfBillingDocuments); //If the DocumentDate is not specified then it will be set to today's date in the header of the consolidated billing document. request.DocumentDate = *requestDocumentDate*; //If the DueDate is not specified then it will be empty in the header of the consolidated billing document. request.DueDate = *requestDueDate*; ffbc.ConsolidationService.ConsolidationResponse response = ffbc.ConsolidationService.consolidate(request); consolidateAsyncglobal static ffbc.ConsolidationService.ConsolidationAsyncResponse consolidateAsync(ffbc.ConsolidationService.ConsolidationAsyncRequest request) Consolidates the supplied billing documents using a background process. This returns an ID of the background process run on the billing documents. Input Parameters
Return ValueA response containing the results of the ConsolidationAsyncRequest. 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. /** * Example of using consolidateAsync() method of ConsolidationService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of billing documents to consolidate asynchronously, identified by ID. Set<Id> setOfBillingDocuments = New Set<Id> {*billingDocumentIds*} ffbc.ConsolidationService.ConsolidationAsyncRequest request = new ffbc.ConsolidationService.ConsolidationAsyncRequest(setOfBillingDocuments); request.GroupingRuleId = {*consolidationGroupingMethodId*} ffbc.ConsolidationService.ConsolidationAsyncResponse response = ffbc.ConsolidationService.consolidateAsync(request); undoConsolidationglobal static ffbc.ConsolidationService.UndoConsolidationResponse undoConsolidation(ffbc.ConsolidationService.UndoConsolidationRequest request) Undoes consolidation of the supplied billing documents provided that they are valid. The billing documents are valid if all of the following are true: Input Parameters
Return ValueA response containing the results of the UndoConsolidationRequest. 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. /** * Example of using undoConsolidation() method of ConsolidationService API * Variables marked by asterisks need to be queried from your organisation's data. */ //Set of billing documents to undo consolidation, identified by ID. Set<Id> setOfBillingDocuments = New Set<Id> {*billingDocumentIds*} ffbc.ConsolidationService.UndoConsolidationRequest request = new ffbc.ConsolidationService.UndoConsolidationRequest(setOfBillingDocuments); ffbc.ConsolidationService.UndoConsolidationResponse response = ffbc.ConsolidationService.undoConsolidation(request); ffbc.ConsolidationService.AdditionRequestglobal class AdditionRequest extends ConsolidationRequest This class provides the information required to add billing documents to a consolidated billing document. If DocumentDate and DueDate are supplied, they override the existing values on the consolidated billing document. This class extends ffbc.ConsolidationService.ConsolidationRequest Properties
MethodsAdditionRequestglobal AdditionRequest(Set<Id> BillingDocumentIds) Create a new AdditionRequest for the given BillingDocumentIds. Input Parameters
ffbc.ConsolidationService.ConsolidationAsyncRequestglobal class ConsolidationAsyncRequest extends ConsolidationRequest This class provides the information required to consolidate billing documents using a background process. This class extends ffbc.ConsolidationService.ConsolidationRequest Properties
MethodsConsolidationAsyncRequestglobal ConsolidationAsyncRequest(Set<Id> BillingDocumentIds) Creates a new ConsolidationAsyncRequest for the given BillingDocumentIds. Input Parameters
ffbc.ConsolidationService.ConsolidationAsyncResponseglobal class ConsolidationAsyncResponse extends Response The response returned by the ConsolidationAsyncRequest. Contains the ID of the Background Process object and the ID of the background process job running on the billing documents. If an error occurs, the ID of any billing document related to the error is included in the response. This class extends ffbc.Response Properties
ffbc.ConsolidationService.ConsolidationRequestglobal virtual class ConsolidationRequest This class provides the information required to consolidate billing documents. If DocumentDate and DueDate are not supplied, they are resolved as detailed in the Properties table below. Properties
MethodsConsolidationRequestglobal ConsolidationRequest(Set<Id> BillingDocumentIds) Creates a new ConsolidationRequest for the given BillingDocumentIds. Input Parameters
ffbc.ConsolidationService.ConsolidationResponseglobal class ConsolidationResponse extends Response The response returned by the ConsolidationRequest. Contains the ID of the resulting consolidated billing document (if created) and any errors produced by the process. If an error occurs, the process rolls back. The ID of any billing document related to the error is included in the response. This class extends ffbc.Response Properties
ffbc.ConsolidationService.UndoConsolidationRequestglobal class UndoConsolidationRequest This class provides the information required to undo the consolidation of billing documents. Properties
MethodsUndoConsolidationRequestglobal UndoConsolidationRequest(Set<Id> BillingDocumentIds) Creates a new UndoConsolidationRequest for the given BillingDocumentIds. Input Parameters
ffbc.ConsolidationService.UndoConsolidationResponseglobal class UndoConsolidationResponse extends Response The response returned by the UndoConsolidationRequest. Contains the IDs of the original billing documents that have been reinstated with the “Draft” status, and any errors produced by the process. If an error occurs, the process rolls back. The ID of any billing document related to the error is included in the response. This class extends ffbc.Response Properties
|