Overview 
The following provides information when using the API for the creation of records in the Account Payable, Cash Disbursement and Expense recognition cycles of Accounting Seed including the following:
  • Object API names
  • Required fields for inserting a record
  • calling a global class to post a record
Accounts Payable
 
The following fields are required on the Account Payable object: AcctSeed__Account_Payable__c
Field Name  API Name  Type
 Vendor
 Contact
 Employee

Either an Account, Contact or User can be a payee. One is required and only on can be used.
 AcctSeed__Vendor__c
 AcctSeed__Contact__c
 AcctSeed__Employee__c
 Lookup (Account)
 Lookup (Contact)
 Lookup (User) 
 Payee Reference  AcctSeed__Payee_Reference__c  Text (250)
 Issue Date  AcctSeed__Date__c  Date
 
The following fields are required on the Account Payable Line object: AcctSeed__Account_Payable_Line__c 
 Field Name  API Name  Type
 Account Payable                  AcctSeed__Account_Payable__c  Master-Detail (Account Payable)
 Amount__c  AcctSeed__Amount__c  Currency (16,2)
 Expense GL Account

This field is not needed if a default Expense GL Account is set on the Account
 AcctSeed__Expense_GL_Account__C  Lookup (GL Account)
 
 
Posting or Unposting an Account Payable via Apex Code
 
There is a global class in the Accounting Seed Financial Suite managed package called AccountPayablePostService. This class can be called through Apex Code external to the Accounting Seed Financial Suite package to post or unpost a set of account payable records. Please note the following: 
 
  • This class contains two static global methods. One of the static methods is related to posting account payable records and is called postAccountPayables. The other static method is related to unposting account payable records and is called unpostAccountPayables.
  • You cannot call either the post or unpost methods with a set of account payable records where the aggregate line count is more than 1,000 account payable lines. If you need to post or unpost more than 1,000 account payable lines, you will need to call the class static method from a class which supports batch apex.
  • Each method returns a list of post result records, which will indicate if the account payable was posted or unposted successfully. If the record was not posted or unposted successfully, an error status code is provided documenting the reason the record was not posted or unposted.
  • The following error status codes are supported for the AccountPayablePostService class:
Account Payable Post Method
    • LINE_COUNT_LIMIT_EXCEEDED - Attempted to post a set of account payable records where the aggregate number of account payable lines exceeded 1,000.
    • CLOSED_ACCOUNTING_PERIOD - Accounting period associated with the account payable is closed.
    • ALREADY_POSTED - The record has already been posted.
    • STATUS_NOT_APPROVED - The account payable status is not approved. 
    • NO_CONTROL_AP_ACCOUNT_DEFINED – An Account Payable GL Account needs to be defined on the account settings tab to post the account payable records.
    • SYSTEM_EXCEPTION - Internal exception.
Account Payable Unpost Method
    • LINE_COUNT_LIMIT_EXCEEDED - Attempted to unpost a set of account payable records where the aggregate number of account payable lines exceeded 1,000.
    • CLOSED_ACCOUNTING_PERIOD - Accounting period associated with the account payable is closed.
    • AP_DISBURSEMENTS_EXIST – Account payable record has associated AP disbursement records and cannot be un-posted.
    • AP_CREDIT_MEMOS_EXIST - AP credit memo exist which are associated with this account payable. You must delete all AP credit memos before you can unpost.
    • SYSTEM_EXCEPTION - Internal exception.
 
Example using the AccountPayablePostService class to post and unpost a set of account payable records.
// Create account payable records to post and unpost
AcctSeed__Account_Payable__c[] payables = new List <AcctSeed__Account_Payable__c> ();
payables.add(
    new AcctSeed__Account_Payable__c(
        AcctSeed__Date__c = System.today(),
        AcctSeed__Vendor__c = [Select Id From Account limit 1].Id,
        AcctSeed__Status__c = 'Approved',
        AcctSeed__Due_Date__c = System.today() + 30,
        AcctSeed__Payee_Reference__c = 'ThisIsATestPayeeReference123'
    )
);

payables.add(
    new AcctSeed__Account_Payable__c(
        AcctSeed__Date__c = System.today(),
        AcctSeed__Vendor__c = [Select Id From Account limit 1].Id,
        AcctSeed__Status__c = 'Approved',
        AcctSeed__Due_Date__c = System.today() + 30,
        AcctSeed__Payee_Reference__c = 'ThisIsATestPayeeReference456'
    )
);

insert payables;

// Create account payable line records to post and unpost
AcctSeed__Account_Payable_Line__c[] apLines = new List <AcctSeed__Account_Payable_Line__c> ();
AcctSeed__GL_Account__c glAccount = [Select Id From AcctSeed__GL_Account__c Where AcctSeed__Type__c = 'Expense' limit 1];

for (AcctSeed__Account_Payable__c ap : payables) {
    AcctSeed__Account_Payable_Line__c apLine = new AcctSeed__Account_Payable_Line__c();
    apLine.AcctSeed__Account_Payable__c = ap.Id;
    apLine.AcctSeed__Date__c = System.today();
    apLine.AcctSeed__Amount__c = 45;
    apLine.AcctSeed__Quantity__c = 1;
    apLine.AcctSeed__Expense_GL_Account__c = glAccount.Id;
    apLines.add(apLine);

    apLine = new AcctSeed__Account_Payable_Line__c();
    apLine.AcctSeed__Account_Payable__c = ap.Id;
    apLine.AcctSeed__Date__c = System.today();
    apLine.AcctSeed__Amount__c = 25;
    apLine.AcctSeed__Quantity__c = 1;   
    apLine.AcctSeed__Expense_GL_Account__c = glAccount.Id;
    apLines.add(apLine);
}

insert apLines;

// Call the post service
AcctSeed.PostResult[] postResults = AcctSeed.AccountPayablePostService.postAccountPayables(payables);

// Loop through post results
for (AcctSeed.PostResult theResult : postResults) {
    if (theResult.isSuccess) {
        System.debug('Successfully posted account payable: ' + theResult.id);
    } 
    else {
        System.debug('Error posting account payable ' + theResult.id);
        for (AcctSeed.PostResult.PostErrorResult errorResult: theResult.errors) {
            System.debug('Error status code ' + errorResult.statusCode);
            System.debug('Error message ' + errorResult.message);
        }
    }
}

// Call the unpost service
AcctSeed.PostResult[] unpostResults = AcctSeed.AccountPayablePostService.unpostAccountPayables(payables);

// Loop through unpost results
for (AcctSeed.PostResult theResult : unpostResults) {
    if (theResult.isSuccess) {
        System.debug('Successfully unposted account payable: ' + theResult.id);
    } 
    else {
        System.debug('Error unposting account payable ' + theResult.id);
        for (AcctSeed.PostResult.PostErrorResult errorResult: theResult.errors) {
            System.debug('Error status code ' + errorResult.statusCode);
            System.debug('Error message ' + errorResult.message);
        }
    }
}


 
 Cash Disbursements
 
Cash disbursements represent funds paid to a vendor. Below are the required fields for a Cash Disbursement. 
 
 Field Name  API Name  Type
 Cash Disbursement Batch  AcctSeed__Cash_Disbursement_Batch__c  Master-Detail (Cash Disbursement Batch)
 Check
 Reference
Note-Check is used if paper check, Reference is used for electronic payment
 AcctSeed__Check_Number__c
 AcctSeed__Reference__c
 Number (18,0)
 Text (200)
 Disbursement Date  AcctSeed__Disbursement_Date__c  Date
 Amount  AcctSeed__Amount__c  Currency 16,2
 Vendor  AcctSeed__Vendor__c  Lookup Account
 Accounting Period  AcctSeed__Accounting_Period__c  Lookup Accounting Period
 Debit GL Account  AcctSeed__Debit_GL_Account__c  Lookup GL Account
 Bank Account  AcctSeed__Bank_Account__c  Lookup GL Account
 Type  AcctSeed__Type__c  Pick list (Check, Electronic)
 

Posting or Unposting a Cash Disbursement via Apex Code

There is a global class in the Accounting Seed Financial Suite managed package called CashDisbursementPostService. This class can be called through Apex Code external to the Accounting Seed Financial Suite package to post or unpost a set of cash disbursement records. Please note the following:

  • This class contains two static global methods. One of the static methods is related to posting account payable records and is called postCashDisbursements. The other static method is related to unposting account payable records and is called unpostCashDisbursements.
  • You cannot call either the post or unpost methods with a set of cash disbursement records of more than 1,000. If you need to post or unpost more than 1,000 cash disbursements, you will need to call the class static method from a class which supports batch apex.
  • Each method returns a list of post result records, which will indicate if the account payable was posted or unposted successfully. If the record was not posted or unposted successfully, an error status code is provided documenting the reason the record was not posted or unposted.
  • The following error status codes are supported for the CashDisbursementPostService class:

Cash Disbursement Post Method

  • LINE_COUNT_LIMIT_EXCEEDED - Attempted to post a set of cash disbursement with a count greater than 1,000.
  • CLOSED_ACCOUNTING_PERIOD - Accounting period associated with the account payable is closed.
  • PAYMENT_STATUS_VOID - The cash disbursement has been voided and cannot be posted.
  • ALREADY_POSTED - The record has already been posted.
  • NO_CONTROL_AP_ACCOUNT_DEFINED – An Account Payable GL Account needs to be defined on the account settings tab to post the account payable records.
  • SYSTEM_EXCEPTION - Internal exception.

Cash Disbursement Unpost Method

  • LINE_COUNT_LIMIT_EXCEEDED - Attempted to unpost a set of cash disbursement with a count greater than 1,000.
  • CLOSED_ACCOUNTING_PERIOD - Accounting period associated with the account payable is closed.
  • CLEARED_BANK_RECONCILIATION - The cash disbursement is associated with a bank reconciliation and cannot be unposted.
  • SYSTEM_EXCEPTION - Internal exception.

Example using the CashDisbursementPostService class to post and unpost a set of cash disbursement records.

// Create cash disbursement records to post and unpost
AcctSeed__Cash_Disbursement_Batch__c[] cashDisbursementBatch = new List<AcctSeed__Cash_Disbursement_Batch__c>();
cashDisbursementBatch.add(
    new AcctSeed__Cash_Disbursement_Batch__c(
        AcctSeed__Starting_Check_Number__c = 1,
        Name = 'Test Batch'
    )
);

cashDisbursementBatch.add(
    new AcctSeed__Cash_Disbursement_Batch__c(
        AcctSeed__Starting_Check_Number__c = 2,
        Name = 'Test Batch 2'
    )
);

insert cashDisbursementBatch;

AcctSeed__Cash_Disbursement__c[] cashDisbursements = new List<AcctSeed__Cash_Disbursement__c>();
AcctSeed__GL_Account__c glAccount = [Select Id From AcctSeed__GL_Account__c Where AcctSeed__Bank__c = true limit 1];
Account acct = [Select Id From Account Limit 1];
Contact contact = [Select Id From Contact Limit 1];
AcctSeed__Accounting_Period__c acctPeriod = [Select Id, AcctSeed__Start_Date__c From AcctSeed__Accounting_Period__c Where AcctSeed__Status__c = 'Open' Limit 1];

cashDisbursements.add(
    new AcctSeed__Cash_Disbursement__c(
        AcctSeed__Cash_Disbursement_Batch__c = cashDisbursementBatch[0].Id,
        AcctSeed__Disbursement_Date__c = acctPeriod.AcctSeed__Start_Date__c,
        AcctSeed__Type__c = 'Check',
        AcctSeed__Amount__c = 12,
        AcctSeed__Source__c = 'Account Payable',
        AcctSeed__Bank_Account__c = glAccount.Id,
        AcctSeed__Vendor__c = acct.Id,
        AcctSeed__Accounting_Period__c = acctPeriod.Id,
        AcctSeed__Status__c = 'In Process',
        AcctSeed__Reference__c = 'the reference 1'
    )
);

cashDisbursements.add(
    new AcctSeed__Cash_Disbursement__c(
        AcctSeed__Cash_Disbursement_Batch__c = cashDisbursementBatch[0].Id,
        AcctSeed__Disbursement_Date__c = acctPeriod.AcctSeed__Start_Date__c,
        AcctSeed__Type__c = 'Check',
        AcctSeed__Amount__c = 123,
        AcctSeed__Source__c = 'Account Payable',
        AcctSeed__Bank_Account__c = glAccount.Id,
        AcctSeed__Contact__c = contact.Id,
        AcctSeed__Accounting_Period__c = acctPeriod.Id,
        AcctSeed__Status__c = 'In Process',
        AcctSeed__Reference__c = 'the reference 2'
    )
);

cashDisbursements.add(
    new AcctSeed__Cash_Disbursement__c(
        AcctSeed__Cash_Disbursement_Batch__c = cashDisbursementBatch[1].Id,
        AcctSeed__Disbursement_Date__c = acctPeriod.AcctSeed__Start_Date__c,
        AcctSeed__Type__c = 'Check',
        AcctSeed__Amount__c = 123,
        AcctSeed__Source__c = 'Account Payable',
        AcctSeed__Bank_Account__c = glAccount.Id,
        AcctSeed__Employee__c = UserInfo.getUserId(),
        AcctSeed__Accounting_Period__c = acctPeriod.Id,
        AcctSeed__Status__c = 'In Process',
        AcctSeed__Reference__c = 'the reference 3'
    )
);

cashDisbursements.add(
    new AcctSeed__Cash_Disbursement__c(
        AcctSeed__Cash_Disbursement_Batch__c = cashDisbursementBatch[1].Id,
        AcctSeed__Disbursement_Date__c = acctPeriod.AcctSeed__Start_Date__c,
        AcctSeed__Type__c = 'Check',
        AcctSeed__Amount__c = 123,
        AcctSeed__Source__c = 'Account Payable',
        AcctSeed__Bank_Account__c = glAccount.Id,
        AcctSeed__Debit_GL_Account__c = glAccount.Id,
        AcctSeed__Employee__c = UserInfo.getUserId(),
        AcctSeed__Accounting_Period__c = acctPeriod.Id,
        AcctSeed__Status__c = 'In Process',
        AcctSeed__Reference__c = 'the reference 4'
    )
);

insert cashDisbursements;


// Call the post service
AcctSeed.PostResult[] postResults = AcctSeed.CashDisbursementPostService.postCashDisbursements(cashDisbursements);

// Loop through post results
for (AcctSeed.PostResult theResult : postResults) {
    if (theResult.isSuccess) {
        System.debug('Successfully posted cash disbursement: ' + theResult.id);
    } 
    else {
        System.debug('Error posting cash disbursement ' + theResult.id);
        for (AcctSeed.PostResult.PostErrorResult errorResult: theResult.errors) {
            System.debug('Error status code ' + errorResult.statusCode);
            System.debug('Error message ' + errorResult.message);
        }
    }
}

// Call the unpost service
AcctSeed.PostResult[] unpostResults = AcctSeed.CashDisbursementPostService.unpostCashDisbursements(cashDisbursements);

// Loop through unpost results
for (AcctSeed.PostResult theResult : unpostResults) {
    if (theResult.isSuccess) {
        System.debug('Successfully unposted cash disbursement: ' + theResult.id);
    } 
    else {
        System.debug('Error unposting cash disbursement ' + theResult.id);
        for (AcctSeed.PostResult.PostErrorResult errorResult: theResult.errors) {
            System.debug('Error status code ' + errorResult.statusCode);
            System.debug('Error message ' + errorResult.message);
        }
    }
}


 
Scheduled Revenue & Expense
The Scheduled Revenue and Expense object is a common integration point for Accounting Seed. Below are the required fields for a single Scheduled Revenue and Expense entry.
 
The following fields are required on the Scheduled Revenue and Expense: AcctSeed__Scheduled_Revenue_Expense__c
 
Field Name   API Name  Type
 Sched Rev Exp Name  Name  Text (80)
 Amount  AcctSeed__Amount__c  Currency (16,2)
 Accounting Period  AcctSeed__Accounting_Period__c  Lookup (Accounting Period)
 Debit GL Account  AcctSeed__Debit_GL_Account__c  Lookup (GL Account)
 Credit GL Account  AcctSeed__Credit_GL_Account__c  Lookup (GL Account)

 

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.