Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Version 2.116 and up

It is now possible to automate pre-invoice generation using APEX which will run the batch job and create Pre-Invoices for Media Campaigns based on certain pre-defined criteria and following the payment criteria set out in the Media Campaign. 

...

To find out more, please talk to your Account Manager about creating pre-invoices using APEX.

Create Pre-Invoices (using APEX)

Build your own way to create Pre-Invoices by using APEX code. The global class ADvendio.GenerateInvoiceBatch can be used to start a batch job that will create Pre-Invoices for Media Campaigns.

Simple call

Code Block
languagejava
new ADvendio.GenerateInvoiceBatch().startBatch();

This will start the Pre-Invoice generation for all Media Campaigns in the with the Bill Me checkbox = true and the following fields set:

  • Payment Interval

  • Payment Start

  • Payment Due to

Advanced call

Code Block
languagejava
ADvendio.GenerateInvoiceBatch generateInvoiceBatch = new ADvendio.GenerateInvoiceBatch();
generateInvoiceBatch.query = 'SELECT Id, Name FROM ADvendio__MediaCampaign__c WHERE ADvendio__LegalEntity__c = \'a1EA000000FfEBSMA3\'AND ADvendio__BillMe__c = True';
Database.executeBatch(generateInvoiceBatch, 1);

This example will create Pre-Invoices for the all Media Campaign with Legal Entity 'a1EA000000FfEBSMA3' where Bill Me is set to True.

You can change the query WHERE condition as you like (see Salesforce SOQL documentation). Linking variables using a colon (:) will not work, because the query will be executed in a different context.

Email Recipients

Code Block
languagejava
ADvendio.GenerateInvoiceBatch generateInvoiceBatch = new ADvendio.GenerateInvoiceBatch();
generateInvoiceBatch.query = 'SELECT Id, Name FROM ADvendio__MediaCampaign__c WHERE ADvendio__LegalEntity__c = \'a1EA000000FfEBSMA3\'AND ADvendio__BillMe__c = True';
generateInvoiceBatch.resultEmailAddress = 'mail1@advendio.com, mail2@advendio.com';
Database.executeBatch(generateInvoiceBatch, 1);

This example will create Pre-Invoices for the all Media Campaign with Legal Entity 'a1EA000000FfEBSMA3' where Bill Me is set to True.

When the job is complete, the result email will be sent to mail1@advendio.com and mail2@advendio.com