c2g.BillingDocumentPostingService
global with sharing class BillingDocumentPostingService
A service providing functionality for posting Billing Documents to create Transactions.
Methods
postNow
global 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: - Have a status of 'Complete' - Have a Foundations company that matches an FFA company - Have a currency that matches an existing accounting currency for the company - Either have a document date that lies within an open period, or have a period override corresponding to an open period - Have an account with an accounts receivable control - Have lines with products that have a sales revenue account - Not have already been posted The postNow method cannot post billing documents that were completed by a user in another company. We recommend that you assign the "FFA Integrations - FDN Billing Document - Retry Post" permission set to users who will trigger a call to this API. Users must also be logged into the company that matches the billing document being posted.
Input Parameters
Exceptions Thrown
PostingException |
Thrown if there are any problems meaning that a document cannot be posted. If an exception is thrown then no documents will be posted. Some documents may be updated to indicate what errors were encountered on that document. Documents are still removed from the queue to be posted, after fixing errors they can be posted by using either this service or the 'Retry Post' button. |
Sample Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | 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());
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.PostingRequest
global with sharing class PostingRequest
A request to post particular billing documents.
Properties
BillingDocumentIds |
Set<Id> |
The IDs of the billing documents to post.
|
Methods
PostingRequest
global 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.PostingException
global with sharing class PostingException extends Exception
A simple Exception extension thrown by the Billing Document Posting Service.
|