Conga Product Documentation

Welcome to the new doc site. Some of your old bookmarks will no longer work. Please use the search bar to find your desired topic.

Creating Invoices

createInvoices API is used to create Invoices automatically. It accepts a list of Account IDs and creates Invoices for each AccountID.

API

Signature

createInvoices

static void createInvoices(Set billToAccountIds, Datetime targetDateTime, Date invoiceDate)

This API is used to create invoices for givens Account IDs. It accepts a Set of Account IDs, invoiceDate, and targetDateTime as input parameters. It creates invoices for all orders with billing schedules having status as pending billing and end date less than targetDateTime. All the new invoices are created with Invoice Date as the value mentioned in invoiceDate.

Request

Field

Type

Required?

Description

billToAccountIds

Set <Id>

Yes

Set of bill to Account IDs

targetDateTime

Datetime

Yes

Process through Date

invoiceDate

Date

Yes

Invoice Creation Date

Code Sample
Set<ID> billToAccountIDs = new Set<ID>();
Date invoiceDate = Date.newInstance(2017, 1, 1);
Date myDate = Date.newInstance(2017, 1, 1);
Time myTime = Time.newInstance(3, 3, 3, 0);
DateTime targetDateTime = DateTime.newInstance(myDate, myTime);
Apttus_Billing.BillingService.createInvoices(billToAccountIDs, invoiceDate, targetDateTime);

API

Signature

createInvoices

static void createInvoices(Set billToAccountIds, Apttus_Billing.InvoiceCreationOptions options)

This API is used to create invoices for given Account IDs. It accepts a set of Account IDs and a class containing invoice creation options. the class contains options that influence the creation of an Invoice such as Invoice Date, Invoice Through Date and Auto Approve.

Request

Field

Type

Required?

Description

billToAccountIds

Set <Id>

Yes

Set of bill to Account IDs

options

Apttus_Billing.InvoiceCreationOptions

Yes

Class holding the Invoice Creation Options

DataObject - Billing.InvoiceCreationOptions

Field

Type

Description

abort

Boolean

If the process is aborted.

autoApprove

Boolean

Mandatory Constructor. IfautoApprovefor Invoice is set to true.

autoApproveAmount

Decimal

Mandatory Constructor. The amount provided for auto approval.

autoApproveCreditMemo

Boolean

Mandatory Constructor. If the autoApproveCreditMemo is set to true

autoApproveOperator

String

Mandatory Constructor. The selected

autoApproveOperator such as Greater than, Less than etc.

invoiceDate

Date

Mandatory Constructor. The Invoice Date.

invoiceDateType

String

The Invoice Date Type such as month or year.

invoiceRun

Apttus_Billing

__InvoiceRun__c

The Invoice Run Object API Name.

invoiceRunResult

Apttus_Billing

__InvoiceRunResult__c

The Invoice Run Result Object API Name.

numberAccountsProcessed

Integer

The number of accounts processed as part of the Invoice Runs.

numberCreditMemos

Genenerated

Integer

The number of Credit Memos generated.

numberInvoicesGenenerated

Integer

The number of Invoices generated.

numberOfAccountsThat

GeneratedCreditMemos

Integer

Number of accounts for which Credit Memos are generated.

numberOfAccountsThat

GeneratedInvoices

Integer

Number of accounts for which Invoices are generated.

numberOfAutoApprovedInvoices

Integer

Number of Invoices that are auto-approved.

numberOfCreditMemos

AutoApproved

Integer

Number of Credit Memos that are auto-approved.

numberOfSuppressedInvoices

Integer

Number of Invoices that are suppressed.

processThruDate

Date

Mandatory Constructor.The Process through date for invoice

splitInvoicesByOrder

Boolean

Mandatory Constructor. If Split Invoices By Order is set to true.

suppressInvoicesAmount

Decimal

Mandatory Constructor.The amount till

which you want to suppress invoices.

suppressInvoicesOperator

String

Mandatory Constructor.

.The selected Suppress Invoices operator

such as Greater than, Less than etc.

taxCallbackStatus

String

The status of Tax Callback.

credtiMemoCreationOption

String

The credit memo creation option. For information on credit memo creation options, refer to Generating Credit Memos from Invoice Run.

autoSendEmailforInvoice

Boolean

Set it to true to auto-send an email once the invoice is generated.

autoSendEmailforCreditMemo

Boolean

Set it to true to auto-send an email once the credit memo is generated

InvoiceOverrideTemplate

String

Name of the invoice template to override the default invoice template

CreditMemoOverrideTemplate

String

Name of the credit memo template name to override the default credit memo template

Note: Only the following values are currently supported for createInvoice API:
  • autoSendEmailforInvoice: false
  • autoSendEmailforCreditMemo: false
  • InvoiceOverrideTemplate: NULL
  • CreditMemoOverrideTemplate: NULL
Code Sample
Set<ID> billToAccountIDs = new Set<ID>();
Date invoiceDate = Date.newInstance(2017, 1, 1);
Date processThruDate = Date.newInstance(2017, 1, 1);
Boolean autoApprove = true;
Boolean splitInvoicesByOrder = true;
String autoApproveOperator = 'Greater than';
Decimal autoApproveAmount = 5.00 ;
String suppressInvoicesOperator = 'Less than';
Decimal suppressInvoicesAmount = 2.00;
Boolean autoApproveCreditMemo = true;
Apttus_Billing.InvoiceCreationOptions options = new Apttus_Billing.InvoiceCreationOptions(
invoiceDate,
processThruDate, 
autoApprove,
splitInvoicesByOrder,
autoApproveOperator,
autoApproveAmount,
suppressInvoicesOperator,
suppressInvoicesAmount,
autoApproveCreditMemo);

Apttus_Billing.BillingService.createInvoices(billToAccountIDs, options);

Code Sample

Use this code sample to provide credit memo creation options while generating invoices through the createInvoices API.
Set<ID> billToAccountIDs = new Set<ID>();
Date invoiceDate = Date.newInstance(2018,1,1); 
Date processThruDate = Date.newInstance(2018,9,9);
Boolean autoApprove = true;
Boolean splitInvoicesByOrder = false;
String autoApproveOperator = 'Greater than';
Decimal autoApproveAmount = 20.00 ; 
String suppressInvoicesOperator = 'Less than';
Decimal suppressInvoicesAmount = 2.00; 
Boolean autoApproveCreditMemo = true;
String credtiMemoCreationOption = 'Single Credit Memo for all Negative Schedules per Invoice';
Boolean autoSendEmailForInvoice = false;
Boolean autoSendEmailForCreditMemo = false;
String InvoiceOverrideTemplate = NULL;
String CreditMemoOverrideTemplate = NULL;
billToAccountIDs.add('0017F00000tPMvL');
InvoiceCreationOptions
options = new InvoiceCreationOptions( invoiceDate,
processThruDate,
autoApprove,
splitInvoicesByOrder,
autoApproveOperator,
autoApproveAmount,
suppressInvoicesOperator,
suppressInvoicesAmount,
autoApproveCreditMemo,
credtiMemoCreationOption,
autoSendEmailForInvoice,
autoSendEmailForCreditMemo,
InvoiceOverrideTemplate, 
CreditMemoOverrideTemplate);
BillingService.createInvoices(billToAccountIDs,options);