c2g.BillingDocumentPostingServiceglobal with sharing class BillingDocumentPostingService a service providing functionality for posting billing documents to create transactions. MethodspostNowglobal static void postNow(c2g.BillingDocumentPostingService.PostingRequest request) Posts one or more billing documents immediately, instead of waiting for background posting. Documents posted in this way will be removed from the queue of documents to be posted by the background posting job. Use the PostFDNBillingDocuments (Post FDN Billing Documents) custom permission to grant permissions on this method. This method can only post billing documents from one company at a time. Documents to be posted must: Input Parameters
Exceptions Thrown
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. Set<Id> billingDocumentIds; c2g.BillingDocumentPostingService.PostingRequest request = new c2g.BillingDocumentPostingService.PostingRequest(billingDocumentIds); try { c2g.BillingDocumentPostingService.postNow(request); } catch (Exception e) { System.debug(LoggingLevel.ERROR, e.getMessage()); //In case of an exception no documents will have been posted, but documents may be updated with //an error specific to that document. List<fferpcore__BillingDocument__c> documents = [ SELECT Id, c2g__PostingStatus__c, c2g__PostingError__c FROM fferpcore__BillingDocument__c WHERE Id IN :billingDocumentIds ]; for (fferpcore__BillingDocument__c document : documents) { if (document.c2g__PostingStatus__c == 'Error') { System.debug( LoggingLevel.ERROR, 'Billing document ' + document.Id + ' failed with error ' + document.c2g__PostingError__c ); } } } c2g.BillingDocumentPostingService.PostingRequestglobal with sharing class PostingRequest a request to post particular billing documents. Properties
MethodsPostingRequestglobal PostingRequest(Set<Id> billingDocumentIds) Construct a new posting request for a particular set of billing document IDs. IDs passed into this constructor will be set on the BillingDocumentIds property. c2g.BillingDocumentPostingService.PostingExceptionglobal with sharing class PostingException extends Exception A simple Exception extension thrown by the Billing Document Posting Service. |