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 original and consolidated billing documents must have the same value for the Document Type, Currency, Company, and Account fields. The original billing documents must have line items. 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> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.ConsolidationService.AdditionRequest request = new ffbc.ConsolidationService.AdditionRequest(setOfBillingDocumentIds); request.ConsolidatedBillingDocumentId = *consolidatedBillingDocumentId*; //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 calculated automatically as described in the Properties table of the ConsolidationRequest class. 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> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.ConsolidationService.ConsolidationRequest request = new ffbc.ConsolidationService.ConsolidationRequest(setOfBillingDocumentIds); //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 calculated automatically as described in the Properties table of the ConsolidationRequest class. 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. Draft billing documents are grouped together using the supplied consolidation grouping method. Billing documents with a status other than “Draft”, documents without line items, and documents that cannot be grouped with another are excluded from consolidation. 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> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.ConsolidationService.ConsolidationAsyncRequest request = new ffbc.ConsolidationService.ConsolidationAsyncRequest(setOfBillingDocumentIds); request.GroupingRuleId = *consolidationGroupingMethodId*; //If the ExecutionDescription is not specified then it will be set to the name of the consolidation grouping method, followed by the current date and time. request.ExecutionDescription = *executionDescription*; //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 calculated automatically as described in the Properties table of the ConsolidationRequest class. request.DueDate = *requestDueDate*; ffbc.ConsolidationService.ConsolidationAsyncResponse response = ffbc.ConsolidationService.consolidateAsync(request); consolidateWithRulesAsyncglobal static List<ffbc.ConsolidationService.ConsolidationAsyncResponse> consolidateWithRulesAsync(List<ffbc.ConsolidationService.ConsolidationWithRuleAsyncRequest> requests) Runs the consolidation process using the supplied list of consolidation rules. Parallel background processes are started for each valid consolidation rule in the set. Input Parameters
Return ValueA list of responses containing the results of each ConsolidationWithRuleAsyncRequest. 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 consolidateWithRulesAsync() method of ConsolidationService API * Variables marked by asterisks need to be queried from your organisation's data. */ ffbc.ConsolidationService.ConsolidationWithRuleAsyncRequest request1 = new ffbc.ConsolidationService.ConsolidationWithRuleAsyncRequest(); request1.ConsolidationRuleId = *consolidationRule1Id*; //If the ExecutionDescription is not specified then it will be set to the name of the consolidation rule, followed by the current date and time. request1.ExecutionDescription = *executionDescription*; //If the DocumentDate is not specified then it will be set to today's date in the header of the consolidated billing document. request1.DocumentDate = *requestDocumentDate*; ffbc.ConsolidationService.ConsolidationWithRuleAsyncRequest request2 = new ffbc.ConsolidationService.ConsolidationWithRuleAsyncRequest(); request2.ConsolidationRuleId = *consolidationRule2Id*; request2.ExecutionDescription = *executionDescription*; request2.DocumentDate = *requestDocumentDate*; List<ConsolidationService.ConsolidationWithRuleAsyncRequest> requests = new List<ConsolidationService.ConsolidationWithRuleAsyncRequest>{request1, request2}; List<ConsolidationService.ConsolidationAsyncResponse> responses = ffbc.ConsolidationService.consolidateWithRulesAsync(requests); 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> setOfBillingDocumentIds = New Set<Id> {*billingDocumentIds*}; ffbc.ConsolidationService.UndoConsolidationRequest request = new ffbc.ConsolidationService.UndoConsolidationRequest(setOfBillingDocumentIds); ffbc.ConsolidationService.UndoConsolidationResponse response = ffbc.ConsolidationService.undoConsolidation(request); undoConsolidationAsyncglobal static ffbc.ConsolidationService.UndoConsolidationAsyncResponse undoConsolidationAsync(ffbc.ConsolidationService.UndoConsolidationRequest request) Undoes consolidation of the supplied billing documents using a background process, provided the documents 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 undoConsolidationAsync() 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> setOfBillingDocumentIds = new Set<Id> {*billingDocumentIds*}; ffbc.ConsolidationService.UndoConsolidationRequest request = new ffbc.ConsolidationService.UndoConsolidationRequest(setOfBillingDocumentIds); ffbc.ConsolidationService.UndoConsolidationAsyncResponse response = ffbc.ConsolidationService.undoConsolidationAsync(request); ffbc.ConsolidationService.AdditionRequestglobal with sharing class AdditionRequest extends ConsolidationRequest This class provides the information required to add billing documents to a consolidated billing document. If DocumentDate and DueDate are not supplied, they are resolved as detailed in the Properties table of the inherited class. This class extends ffbc.ConsolidationService.ConsolidationRequest Properties
MethodsAdditionRequestglobal AdditionRequest(Set<Id> BillingDocumentIds) Creates a new AdditionRequest for the given BillingDocumentIds. Input Parameters
ffbc.ConsolidationService.ConsolidationAsyncRequestglobal with sharing class ConsolidationAsyncRequest extends ConsolidationRequest This class provides the information required to consolidate billing documents using a background process. If DocumentDate and DueDate are not supplied, they are resolved as detailed in the Properties table of the inherited class. This class extends ffbc.ConsolidationService.ConsolidationRequest Properties
MethodsConsolidationAsyncRequestglobal ConsolidationAsyncRequest(Set<Id> BillingDocumentIds) Creates a new ConsolidationAsyncRequest for the given BillingDocumentIds. Input Parameters
ffbc.ConsolidationService.ConsolidationWithRuleAsyncRequestglobal with sharing class ConsolidationWithRuleAsyncRequest This class provides the information required to run the consolidation using a consolidation rule. If DocumentDate and ExecutionDescription are not supplied, they are resolved as detailed in the Properties table below. Properties
MethodsConsolidationWithRuleAsyncRequestglobal ConsolidationWithRuleAsyncRequest() ffbc.ConsolidationService.ConsolidationAsyncResponseglobal with sharing class ConsolidationAsyncResponse extends Response The response returned by ConsolidationAsyncRequest and ConsolidationWithRuleAsyncRequest. Contains the ID of the background process record and the ID of the background process job running on the billing documents. This class extends ffbc.Response Properties
ffbc.ConsolidationService.ConsolidationRequestglobal virtual with sharing 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 with sharing 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 with sharing 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 with sharing 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
ffbc.ConsolidationService.UndoConsolidationAsyncResponseglobal with sharing class UndoConsolidationAsyncResponse extends Response The response returned by the UndoConsolidationRequest. Contains the ID of the background process record and the ID of the background process job running on the billing documents. If an error occurs, the background process is not started. The ID of any billing document related to the error is included in the response. This class extends ffbc.Response Properties
|