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

Parameter Type Definition

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

Parameters Type Definition
ObjectName String

Name of the Salesforce object.

Example: ’Account’, ’Product2’

RecordIds List<Id> List of Salesforce record IDs to sync.
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(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

Parameters Type Definition
ObjectName String

Name of the Salesforce object.

Example: ’Project__c’

RecordIds List<Id> A list of Salesforce project IDs to sync.
Action String

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 operator Definition
SYNC_CUSTOMER Account sync
SYNC_PRODUCT Product sync
SYNC_CONTACT Contact sync
SYNC_Project Project sync
CREATE_CONTRACT Create Contract
SYNC_PRICEBOOK Price Book sync
DELETE_CUSTOMER Delete Account callout
DELETE_CONTACT Delete Contact callout
DELETE_PRODUCT Delete Product callout
DELETE_PRICEBOOK Delete Price Book callout
MERGE_CUSTOMER Merge Accounts
UPDATE_CONTRACT Update Contract
SYNC_RENEWAL_CONTRACT Create Renewal Contract
CREATE_OPPORTUNITY_CONTRACT Sync Contract Add-on
C_SYNC_PRICEBOOK Create/update Contract Price book
SYNC_JOURNAL_ENTRY Create Journal Entry