Accounting API Developer's Reference

c2g.TransactionService

global with sharing class TransactionService

The service class relating to Transactions.

Enums

TransactionType

The list of valid options for a transaction type.

Value Description
SALES_INVOICE transaction type.
SALES_CREDITNOTE transaction type.
PAYABLE_INVOICE transaction type.
PAYABLE_CREDITNOTE transaction type.
JOURNAL transaction type.
CASHENTRY transaction type.

TransactionLineType

The list of valid options for a transaction line type.

Value Description
ACCOUNT line type.
ANALYSIS line type.
TAX line type.

Methods

reverseTransactionIds

global static List<Id> reverseTransactionIds(List<c2g.TransactionService.ReverseTransactionInfo> reverseTransactionInfoList)

Returns the list of IDs for new reverse allocation transactions.

Input Parameters

Name Type Description
reverseTransactionInfoList List<c2g.TransactionService.ReverseTransactionInfo> A list of the original transaction IDs and required information to reverse the allocation transaction.

Return Value

This service returns a list of Id objects.

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.

c2g.TransactionService.ReverseTransactionInfo reverseTransactionInfo = new c2g.TransactionService.ReverseTransactionInfo();
reverseTransactionInfo.OriginalTransactionId = 'a2124000000TjIP';
reverseTransactionInfo.ReversePeriodId = 'a1f24000000PdIK';
reverseTransactionInfo.ReverseReason = 'Reverse Reason';
reverseTransactionInfo.ReverseTransactionDate = System.today();
List<Id> reverseTransactionIdList = c2g.TransactionService.reverseTransactionIds(List<c2g.TransactionService.ReverseTransactionInfo>{reverseTransactionInfo});

post

global static List<Id> post(List<c2g.TransactionService.AccountingTransaction> accountingTransactions, c2g.TransactionService.PostOptions postOptions)

Creates and inserts the transactions according to the given list of Accounting Transactions.

Input Parameters

Name Type Description
accountingTransactions List<c2g.TransactionService.AccountingTransaction> A list of accounting transactions to post.
postOptions c2g.TransactionService.PostOptions An instance of PostOptions to configure post behavior.

Return Value

The list of IDs for new posted transactions.

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.

c2g.TransactionService.AccountingTransaction accountingTransaction = new c2g.TransactionService.AccountingTransaction();
accountingTransaction.setTransactionDate(System.today());
accountingTransaction.setPeriodId('a2k36000001lLk4');
accountingTransaction.setTransactionType(c2g.TransactionService.TransactionType.JOURNAL);

c2g.TransactionService.AccountingTransactionLine accountingTransactionLine1 = new c2g.TransactionService.AccountingTransactionLine();
accountingTransactionLine1.setDocumentCurrencyId('a1W360000015OvB');
accountingTransactionLine1.setDocumentValue(100.00);
accountingTransactionLine1.setDueDate(System.today());
accountingTransactionLine1.setGeneralLedgerAccountId('a2B36000000BCZh');
accountingTransactionLine1.setLineDescription('Line1 Description');
accountingTransactionLine1.setLineReference('Line1 Reference');
accountingTransactionLine1.setLineType(c2g.TransactionService.TransactionLineType.ANALYSIS);
accountingTransactionLine1.setFieldValue('MyCustomTextField__c', 'ABC');

accountingTransaction.TransactionLineItems.add(accountingTransactionLine1);

c2g.TransactionService.AccountingTransactionLine accountingTransactionLine2 = new c2g.TransactionService.AccountingTransactionLine();
accountingTransactionLine2.setDocumentCurrencyId('a1W360000015OvB');
accountingTransactionLine2.setDocumentValue(-100.00);
accountingTransactionLine2.setDueDate(System.today());
accountingTransactionLine2.setGeneralLedgerAccountId('a2B36000000BCZh');
accountingTransactionLine2.setLineDescription('Line2 Description');
accountingTransactionLine2.setLineReference('Line2 Reference');
accountingTransactionLine2.setLineType(c2g.TransactionService.TransactionLineType.ANALYSIS);
accountingTransactionLine2.setFieldValue('MyCustomTextField__c', 'DEF');

accountingTransaction.TransactionLineItems.add(accountingTransactionLine2);

c2g.TransactionService.PostOptions postOptions = new c2g.TransactionService.PostOptions();
postOptions.DestinationCompanyId = 'a1r36000000ufsL';
List<Id> postTransactionIdList = c2g.TransactionService.post(new List<c2g.TransactionService.AccountingTransaction>{accountingTransaction}, postOptions);

c2g.TransactionService.ReverseTransactionInfo

global class ReverseTransactionInfo

Holds the original transaction ID and required information to reverse an allocation transaction.

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.

c2g.TransactionService.ReverseTransactionInfo reverseTransactionInfo = new c2g.TransactionService.ReverseTransactionInfo();
reverseTransactionInfo.OriginalTransactionId = 'a2124000000TjIP';
reverseTransactionInfo.ReversePeriodId = 'a1f24000000PdIK';
reverseTransactionInfo.ReverseReason = 'Reverse Reason';
reverseTransactionInfo.ReverseTransactionDate = System.today();

Properties

Name Type Description
OriginalTransactionId Id The ID of the original allocation transaction.
ReverseReason String The reason that you want to reverse the allocation transaction.
ReverseTransactionDate Date The date of the new reverse allocation transaction.
ReversePeriodId Id The ID of the period of the new reverse allocation transaction.

Methods

ReverseTransactionInfo

global ReverseTransactionInfo()

Return Value

This constructor does not return a value.

ReverseTransactionInfo

global ReverseTransactionInfo(Id originalTransactionId, String reverseReason, Date reverseTransactionDate, Id reversePeriodId)

Input Parameters

Name Type Description
originalTransactionId Id The ID of the original allocation transaction.
reverseReason String The reason that you want to reverse the allocation transaction.
reverseTransactionDate Date The date of the new reverse allocation transaction.
reversePeriodId Id The ID of the period of the new reverse allocation transaction.

Return Value

This constructor does not return a value.

c2g.TransactionService.AccountingTransaction

global class AccountingTransaction

Holds the transaction and transaction line items to post.

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.

You need to provide some sample code

Properties

Name Type Description
TransactionLineItems List<c2g.TransactionService.AccountingTransactionLine> Holds the list of the accounting transaction lines.

Methods

AccountingTransaction

global AccountingTransaction()

Return Value

This constructor does not return a value.

setFieldValue

global void setFieldValue(String fieldName, Object value)

Sets the value of your own custom field in the transaction. If the field received as a parameter does not exist, or belongs to FinancialForce Accounting, then an exception is thrown.

Input Parameters

Name Type Description
fieldName String The name of your own custom field to use in the transaction.
value Object The value of your own custom field.

setFieldValue

global void setFieldValue(Schema.SObjectField sObjField, Object value)

Sets the value of your own custom field in the transaction. If the field received as a parameter does not exist, or belongs to FinancialForce Accounting, then an exception is thrown.

Input Parameters

Name Type Description
sObjField Schema.SObjectField Your own custom field to use in the transaction.
value Object The value of your own custom field.

getFieldValue

global Object getFieldValue(String fieldName)

Returns the value of your own custom field in the transaction. If the field received as a parameter does not exist, or belongs to FinancialForce Accounting, then an exception is thrown.

Input Parameters

Name Type Description
fieldName String The name of your own custom field.

Return Value

Field value.

getFieldValue

global Object getFieldValue(Schema.SObjectField sObjField)

Returns the value of your own custom field in the transaction. If the field received as a parameter does not exist, or belongs to FinancialForce Accounting, then an exception is thrown.

Input Parameters

Name Type Description
sObjField Schema.SObjectField Your own custom field.

Return Value

Field value.

setDocumentDescription

global void setDocumentDescription(String value)

Sets the document description of the transaction.

Input Parameters

Name Type Description
value String Document Description.

getDocumentDescription

global String getDocumentDescription()

Returns the document description of the transaction.

Return Value

Document Description.

setDocumentNumber

global void setDocumentNumber(String value)

Sets the document number of the transaction.

Input Parameters

Name Type Description
value String Document Number.

getDocumentNumber

global String getDocumentNumber()

Returns the document number of the transaction.

Return Value

Document Number.

setDocumentReference

global void setDocumentReference(String value)

Sets the document reference of the transaction.

Input Parameters

Name Type Description
value String Document Reference.

getDocumentReference

global String getDocumentReference()

Returns the document reference of the transaction.

Return Value

Document Reference.

setDocumentReference2

global void setDocumentReference2(String value)

Sets the document reference 2 of the transaction.

Input Parameters

Name Type Description
value String Document Reference 2.

getDocumentReference2

global String getDocumentReference2()

Returns the document reference 2 of the transaction.

Return Value

Document Reference 2.

setPeriodId

global void setPeriodId(Id value)

Sets the period Id of the transaction.

Input Parameters

Name Type Description
value Id Period Id.

getPeriodId

global Id getPeriodId()

Returns the period Id of the transaction.

Return Value

Period Id.

setTransactionDate

global void setTransactionDate(Date value)

Sets the transaction date of the transaction.

Input Parameters

Name Type Description
value Date Transaction Date.

getTransactionDate

global Date getTransactionDate()

Returns the transaction date of the transaction.

Return Value

Transaction Date.

setTransactionType

global void setTransactionType(c2g.TransactionService.TransactionType value)

Sets the transaction type of the transaction.

Input Parameters

Name Type Description
value c2g.TransactionService.TransactionType Transaction Type.

getTransactionType

global c2g.TransactionService.TransactionType getTransactionType()

Returns the transaction type of the transaction.

Return Value

Transaction Type.

setVendorDocumentNumber

global void setVendorDocumentNumber(String value)

Sets the vendor document number of the transaction.

Input Parameters

Name Type Description
value String Vendor Document Number.

getVendorDocumentNumber

global String getVendorDocumentNumber()

Returns the vendor document number of the transaction.

Return Value

Vendor Document Number.

c2g.TransactionService.AccountingTransactionLine

global class AccountingTransactionLine

Holds a transaction line item.

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.

You need to provide some sample code

Methods

AccountingTransactionLine

global AccountingTransactionLine()

Return Value

This constructor does not return a value.

setFieldValue

global void setFieldValue(String fieldName, Object value)

Sets the value of your own custom field in the transaction line item. If the field received as a parameter does not exist, or belongs to FinancialForce Accounting, then an exception is thrown.

Input Parameters

Name Type Description
fieldName String The name of your own custom field to use in the transaction line item.
value Object The value of your own custom field.

setFieldValue

global void setFieldValue(Schema.SObjectField sObjField, Object value)

Sets the value of your own custom field in the transaction line item. If the field received as a parameter does not exist, or belongs to FinancialForce Accounting, then an exception is thrown.

Input Parameters

Name Type Description
sObjField Schema.SObjectField Your own custom field to use in the transaction line item.
value Object The value of your own custom field.

getFieldValue

global Object getFieldValue(String fieldName)

Returns the value of your own custom field in the transaction line item. If the field received as a parameter does not exist, or belongs to FinancialForce Accounting, then an exception is thrown.

Input Parameters

Name Type Description
fieldName String The name of your own custom field.

Return Value

Field value.

getFieldValue

global Object getFieldValue(Schema.SObjectField sObjField)

Returns the value of your own custom field in the transaction line item. If the field received as a parameter does not exist, or belongs to FinancialForce Accounting, then an exception is thrown.

Input Parameters

Name Type Description
sObjField Schema.SObjectField Your own custom field.

Return Value

Field value.

setAccountId

global void setAccountId(Id value)

Sets the account Id of the transaction line item.

Input Parameters

Name Type Description
value Id Account Id.

getAccountId

global Id getAccountId()

Returns the account Id of the transaction line item.

Return Value

Account Id.

setAccountValue

global void setAccountValue(Decimal value)

Sets the account value of the transaction line item.

Input Parameters

Name Type Description
value Decimal Account Value.

getAccountValue

global Decimal getAccountValue()

Returns the account value of the transaction line item.

Return Value

Account Value.

setBankAccountId

global void setBankAccountId(Id value)

Sets the bank account Id of the transaction line item.

Input Parameters

Name Type Description
value Id Bank Account Id.

getBankAccountId

global Id getBankAccountId()

Returns the bank account Id of the transaction line item.

Return Value

Bank Account Id.

setBankAccountValue

global void setBankAccountValue(Decimal value)

Sets the bank account value of the transaction line item.

Input Parameters

Name Type Description
value Decimal Bank Account Value.

getBankAccountValue

global Decimal getBankAccountValue()

Returns the bank account value of the transaction line item.

Return Value

Bank Account Value.

setDimension1Id

global void setDimension1Id(Id value)

Sets the dimension1 Id of the transaction line item.

Input Parameters

Name Type Description
value Id Dimension1 Id.

getDimension1Id

global Id getDimension1Id()

Returns the dimension1 Id of the transaction line item.

Return Value

Dimension1 Id.

setDimension1Value

global void setDimension1Value(Decimal value)

Sets the dimension1 value of the transaction line item.

Input Parameters

Name Type Description
value Decimal Dimension1 Value.

getDimension1Value

global Decimal getDimension1Value()

Returns the dimension1 value of the transaction line item.

Return Value

Dimension1 Value.

setDimension2Id

global void setDimension2Id(Id value)

Sets the dimension2 Id of the transaction line item.

Input Parameters

Name Type Description
value Id Dimension2 Id.

getDimension2Id

global Id getDimension2Id()

Returns the dimension2 Id of the transaction line item.

Return Value

Dimension2 Id.

setDimension2Value

global void setDimension2Value(Decimal value)

Sets the dimension2 value of the transaction line item.

Input Parameters

Name Type Description
value Decimal Dimension2 Value.

getDimension2Value

global Decimal getDimension2Value()

Returns the dimension2 value of the transaction line item.

Return Value

Dimension2 Value.

setDimension3Id

global void setDimension3Id(Id value)

Sets the dimension3 Id of the transaction line item.

Input Parameters

Name Type Description
value Id Dimension3 Id.

getDimension3Id

global Id getDimension3Id()

Returns the dimension3 Id of the transaction line item.

Return Value

Dimension3 Id.

setDimension3Value

global void setDimension3Value(Decimal value)

Sets the dimension3 value of the transaction line item.

Input Parameters

Name Type Description
value Decimal Dimension3 Value.

getDimension3Value

global Decimal getDimension3Value()

Returns the dimension3 value of the transaction line item.

Return Value

Dimension3 Value.

setDimension4Id

global void setDimension4Id(Id value)

Sets the dimension4 Id of the transaction line item.

Input Parameters

Name Type Description
value Id Dimension4 Id.

getDimension4Id

global Id getDimension4Id()

Returns the dimension4 Id of the transaction line item.

Return Value

Dimension4 Id.

setDimension4Value

global void setDimension4Value(Decimal value)

Sets the dimension4 value of the transaction line item.

Input Parameters

Name Type Description
value Decimal Dimension4 Value.

getDimension4Value

global Decimal getDimension4Value()

Returns the dimension4 value of the transaction line item.

Return Value

Dimension4 Value.

setDocumentCurrencyId

global void setDocumentCurrencyId(Id value)

Sets the document currency Id of the transaction line item.

Input Parameters

Name Type Description
value Id Document Currency Id.

getDocumentCurrencyId

global Id getDocumentCurrencyId()

Returns the document currency Id of the transaction line item.

Return Value

Document Currency Id.

setDocumentValue

global void setDocumentValue(Decimal value)

Sets the document value of the transaction line item.

Input Parameters

Name Type Description
value Decimal Document Value.

getDocumentValue

global Decimal getDocumentValue()

Returns the document value of the transaction line item.

Return Value

Document Value.

setDualValue

global void setDualValue(Decimal value)

Sets the dual value of the transaction line item.

Input Parameters

Name Type Description
value Decimal Dual Value.

getDualValue

global Decimal getDualValue()

Returns the dual value of the transaction line item.

Return Value

Dual Value.

setDueDate

global void setDueDate(Date value)

Sets the due date of the transaction line item.

Input Parameters

Name Type Description
value Date Due Date.

getDueDate

global Date getDueDate()

Returns the due date of the transaction line item.

Return Value

Due Date.

setGeneralLedgerAccountId

global void setGeneralLedgerAccountId(Id value)

Sets the general ledger account Id of the transaction line item.

Input Parameters

Name Type Description
value Id General Ledger Account Id.

getGeneralLedgerAccountId

global Id getGeneralLedgerAccountId()

Returns the general ledger account Id of the transaction line item.

Return Value

General Ledger Account Id.

setGeneralLedgerAccountValue

global void setGeneralLedgerAccountValue(Decimal value)

Sets the general ledger account value of the transaction line item.

Input Parameters

Name Type Description
value Decimal General Ledger Account Value.

getGeneralLedgerAccountValue

global Decimal getGeneralLedgerAccountValue()

Returns the general ledger account value of the transaction line item.

Return Value

General Ledger Account Value.

setHomeValue

global void setHomeValue(Decimal value)

Sets the home value of the transaction line item.

Input Parameters

Name Type Description
value Decimal Home Value.

getHomeValue

global Decimal getHomeValue()

Returns the home value of the transaction line item.

Return Value

Home Value.

setLineDescription

global void setLineDescription(String value)

Sets the line description of the transaction line item.

Input Parameters

Name Type Description
value String Line Description.

getLineDescription

global String getLineDescription()

Returns the line description of the transaction line item.

Return Value

Line Description.

setLineReference

global void setLineReference(String value)

Sets the line reference of the transaction line item.

Input Parameters

Name Type Description
value String Line Reference.

getLineReference

global String getLineReference()

Returns the line reference of the transaction line item.

Return Value

Line Reference.

setLineType

global void setLineType(c2g.TransactionService.TransactionLineType value)

Sets the line type of the transaction line item.

Input Parameters

Name Type Description
value c2g.TransactionService.TransactionLineType Line Type.

getLineType

global c2g.TransactionService.TransactionLineType getLineType()

Returns the line type of the transaction line item.

Return Value

Line Type.

setProductId

global void setProductId(Id value)

Sets the product Id of the transaction line item.

Input Parameters

Name Type Description
value Id Product Id.

getProductId

global Id getProductId()

Returns the product Id of the transaction line item.

Return Value

Product Id.

setTaxCode1Id

global void setTaxCode1Id(Id value)

Sets the tax code1 Id of the transaction line item.

Input Parameters

Name Type Description
value Id Tax Code1 Id.

getTaxCode1Id

global Id getTaxCode1Id()

Returns the tax code1 Id of the transaction line item.

Return Value

Tax Code1 Id.

setTaxCode2Id

global void setTaxCode2Id(Id value)

Sets the tax code2 Id of the transaction line item.

Input Parameters

Name Type Description
value Id Tax Code2 Id.

getTaxCode2Id

global Id getTaxCode2Id()

Returns the tax code2 Id of the transaction line item.

Return Value

Tax Code2 Id.

setTaxCode3Id

global void setTaxCode3Id(Id value)

Sets the tax code3 Id of the transaction line item.

Input Parameters

Name Type Description
value Id Tax Code3 Id.

getTaxCode3Id

global Id getTaxCode3Id()

Returns the tax code3 Id of the transaction line item.

Return Value

Tax Code3 Id.

setDocumentTaxValue1

global void setDocumentTaxValue1(Decimal value)

Sets the document tax value 1 of the transaction line item.

Input Parameters

Name Type Description
value Decimal Document Tax Value 1.

getDocumentTaxValue1

global Decimal getDocumentTaxValue1()

Returns the document tax value 1 of the transaction line item.

Return Value

Document Tax Value 1.

setDocumentTaxValue2

global void setDocumentTaxValue2(Decimal value)

Sets the document tax value 2 of the transaction line item.

Input Parameters

Name Type Description
value Decimal Document Tax Value 2.

getDocumentTaxValue2

global Decimal getDocumentTaxValue2()

Returns the document tax value 2 of the transaction line item.

Return Value

Document Tax Value 2.

setDocumentTaxValue3

global void setDocumentTaxValue3(Decimal value)

Sets the document tax value 3 of the transaction line item.

Input Parameters

Name Type Description
value Decimal Document Tax Value3.

getDocumentTaxValue3

global Decimal getDocumentTaxValue3()

Returns the document tax value 3 of the transaction line item.

Return Value

Document Tax Value 3.

c2g.TransactionService.PostOptions

global class PostOptions

Contains data for configuring the post.

Properties

Name Type Description
DestinationCompanyId Id Defines the destination company in which the transactions will be created.

Methods

PostOptions

global PostOptions()

Return Value

This constructor does not return a value.