Apex sync commands for Intacct

Use Apex synchronization commands to trigger Sage Intacct Advanced CRM sync operations from your own Salesforce code, including Flows, Process Builder, anonymous Apex, and custom automation.

Apex is an object-oriented programming language that lets you centralize and execute flow and transaction control statements in Salesforce with application calls to Salesforce APIs.

Web service requests and database triggers on objects can also initiate the execution of Apex code.

Sage Intacct has created Apex synchronization commands specifically for the Advanced CRM Integration, allowing you to call and use Intacct Apex classes in your own code.

For more information about Salesforce Apex code, visit the Salesforce Developer site.

SobjectController

The SobjectController class is used to initiate synchronization calls from inside or outside the Advanced CRM Integration package. Because this class uses a global access modifier, it is visible and callable outside the package.

You can use this class to:

  • Synchronize a single record

  • Synchronize records in bulk

Synchronize a single record

Use the following template to synchronize a single record:

Copy
Template
ia_crm.SobjectController instance = new 
ia_crm.SobjectController([ObjectName],[RecordId],[Action],[TransactionDefinitionName]);
instance.customAction();

The customAction() method initiates the synchronization. This method is void; it does not return a value.

Single record sync parameters

ParameterTypeDefinition

ObjectName

String

Name of the Salesforce object.

Example: ’Account’, ’Product2’

RecordId

String

Salesforce ID of the record to sync.

Example: ’ 00000000004MVox’

Action

String

The synchronization operation to perform.

Can be one of the actions listed in the Action List.

TransactionDefinitionName

String

Name of the Intacct custom transaction definition

Example: ’Sales Invoice Rev’

Use null if not applicable.

Single record sync example

The following code example is for synchronizing a single record:

Copy

Example

ia_crm.SobjectController instance = new 
ia_crm.SobjectController(’Account’,’ 01t41000000sitr’ , ’SYNC_CUSTOMER’, null); 
instance.customAction();

Synchronize records in bulk

Use the following template to synchronize multiple records at one time:

Copy
Template
ia_crm.SobjectController instance = new 
ia_crm.SobjectController([ObjectName],[List<Id> RecordIds],[Action],[TransactionDefinitionName]);
instance.customAction();

The customAction() method initiates the synchronization. This method is void; it does not return a value.

Bulk record sync parameters

ParametersTypeDefinition
ObjectNameString

Name of the Salesforce object.

Example: ’Account’, ’Product2’

RecordIdsList<Id>List of Salesforce record IDs to sync.
ActionString

The synchronization operation to perform.

Can be one of the actions listed in the Action List.

TransactionDefinitionNameStringName of the Intacct custom transaction definition(Ex: ’Sales Invoice Rev’)

Bulk record sync example

The following code example is for synchronizing records in bulk:

Copy

Example

List<Id> recordIds = List<Id>();
recordIds.add(accountId);
ia_crm.SobjectController instance = new ia_crm.SobjectController(’Account’, recordIds, ’SYNC_CUSTOMER’, null);
instance.customAction();

Synchronize a transaction

Use the following template to synchronize a transaction:

Copy
Template
ia_crm.SobjectController instance = new 
ia_crm.SobjectController({opportunityIds}, {transactionName}, {applyOnlyToEmptyTransactions});
instance.customAction();

The customAction() method initiates the synchronization. This method is void; it does not return a value.

Transaction sync parameters

Parameters

Definition

opportunityIds

ID of the opportunity.

Example: a list ID: '0061v00000d2Dhm'

transactionName

The name in the Intacct transaction type field.

Example: 'Sales Invoice’ or 'Sales Order', etc.

applyOnlyToEmptyTransactions

Can be True or False.

Set to TRUE if you want to apply {transactionName} to Opportunities with the Intacct transaction field empty.

Set to FALSE if you want to apply {transactionName} to all Opportunities and overwrite the Intacct transaction field.

Synchronize a Project

Use the following template to synchronize a Project:

Copy

Template

List<Id> recordIds = new List<Id>();
recordIds.add(projectId);
ia_crm.SobjectController instance = new ia_crm.SobjectController('Project__c', recordIds, 'SYNC_PROJECT', null);
instance.customAction();

Project sync parameters

ParametersTypeDefinition
ObjectNameString

Name of the Salesforce object.

Example: ’Project__c’

RecordIdsList<Id>A list of Salesforce project IDs to sync.
ActionString

The synchronization operation to perform.

Can be one of the actions listed in the Action List.

Action List

The following is the list of synchronization operations available in the Advanced CRM Integration package.

Sync operatorDefinition
SYNC_CUSTOMERAccount sync
SYNC_PRODUCTProduct sync
SYNC_CONTACTContact sync
SYNC_ProjectProject sync
CREATE_CONTRACTCreate Contract
SYNC_PRICEBOOKPrice Book sync
DELETE_CUSTOMERDelete Account callout
DELETE_CONTACTDelete Contact callout
DELETE_PRODUCTDelete Product callout
DELETE_PRICEBOOKDelete Price Book callout
MERGE_CUSTOMERMerge Accounts
UPDATE_CONTRACTUpdate Contract
SYNC_RENEWAL_CONTRACTCreate Renewal Contract
CREATE_OPPORTUNITY_CONTRACTSync Contract Add-on
C_SYNC_PRICEBOOKCreate/update Contract Price book
SYNC_JOURNAL_ENTRYCreate Journal Entry