Journal API

Zumzum Financials Knowledge Base

    Overview

    The Zumzum Financials Journal API service provides the following capabilities

    • Create a Journal with Journal Line Items
    • Edit a Journal with Journal Line Items
    • Post a Journal with a Journal Line Items
    • Unpost a Journal with Journal Line Items

    Journal With Journal Line Item Description

    Journal records offer an ideal opportunity to create transactions to the Zumzum Financials general ledger.  You should be aware of the following:

    • Journals are created with a default status of “Draft”
    • Only Submit a list of draft Journals to the Journal Service in order to post them to the general ledger.
    • Only one Journal Record may be submitted to post at any one time.
    • All Journal Line Item values will need to be provided as a positive number as negative amounts are not supported.
    • Only Journals that balance to zero for all line items will post successfully with the Post Journal Service.
    • You may create multiple Journals with multiple line items in a single API call
    • Once created, you are unable to add or remove Journal Line Items so you will need to delete the Journal and enter a new journal.
    • Once added, you are unable to remove a Dimension from a Journal Line Item.  You may insert an alternative Dimension with an update call.

    The CreateJournals function will accept the list of ‘JournalWrapper’ as an input parameter.  Below are the required fields when creating a draft Journal with Journal Line Items.

    JournalWrapper API Fields

    Object Name Field Name API Name Data Type Required
    JournalWrapper APICustomFieldWrapper APICustomFieldWrapper List (objectAPIName, fieldAPIName, fieldValue) No
    JournalWrapper Company Company Lookup (Zumzum_Company__c)) No
    JournalWrapper Date PostingDate Date No
    JournalWrapper Foreign Currency TransactionCurrency Lookup (Zumzum_Currency__c) Yes
    JournalWrapper Journal JournalID Lookup (Zumzum_Journal__c) No
    JournalWrapper Journal Line Item JournalLineWrapper List = Zumzum_Journal_Line_Item_c Yes
    JournalWrapper Reference Reference String (255) No
    JournalWrapper Status Status String No

    The CreateJournals function will accept the list of ‘JournalLineWrapper’ as an input parameter.  Below are the required fields when creating a Journal Line Item.

    JournalLineWrapper API Fields

    Object Name Field Name API Name Data Type Required
    JournalLineWrapper APICustomFieldWrapper APICustomFieldWrapper List (objectAPIName, fieldAPIName, fieldValue) No
    JournalLineWrapper Delete Line DeleteLine Boolean No
    JournalLineWrapper Detail Details String (255) No
    JournalLineWrapper Dimension 1 Dimension1 Lookup (Zumzum__Dimension__c) No
    JournalLineWrapper Dimension 2 Dimension2 Lookup (Zumzum__Dimension__c) No
    JournalLineWrapper Dimension 3 Dimension3 Lookup (Zumzum__Dimension__c) No
    JournalLineWrapper Dimension 4 Dimension4 Lookup (Zumzum__Dimension__c) No
    JournalLineWrapper Dimension 5 Dimension5 Lookup (Zumzum__Dimension__c) No
    JournalLineWrapper Dimension 6 Dimension6 Lookup (Zumzum__Dimension__c) No
    JournalLineWrapper Foreign Credit Credit Number (16,2) Yes
    JournalLineWrapper Foreign Debit Debit Number (16,2) Yes
    JournalLineWrapper Journal Line Item ID JournalLineID Lookup (Zumzum_Journal_Line_Item__c) No
    JournalLineWrapper Nominal Account NominalAccount Lookup (Zumzum__Nominal_Account__c) Yes
    JournalLineWrapper Tax Rate TaxRate Lookup (Zumzum_Tax_Rate__c Yes

    The JournalService will accept the list of ‘APICustomFieldWrapper’ as an input parameter.  Once you have created your custom fields on this object, you would be able to pass those as variables to the API for creating and updating records.  Below are the required fields when creating adding custom fields to your API call.

    APICustomFieldWrapper API Fields

    Object Name Field Name API Name Data Type Required
    APICustomFieldWrapper Object API Name objectAPIName String Yes
    APICustomFieldWrapper Field API Name fieldAPIName String Yes
    APICustomFieldWrapper Field Value fieldValue String Yes

    Create a Draft Journal – CreateJournals Method

    Below is information related on how to create a draft Journal with the Journal API service using Apex code.  Zumzum Financials includes a global class called JournalService which you may call from your own Apex code. The CreateJournals method is used to insert Journals with Journal Line Items and returns a list of draft Journals created.

    Global Class Name Method Input Output
    JournalService CreateJournals List “JournalWrapper” List “JournalService.JournalResponse”

    Sample Code: Create Journal

    This example is provided to help you begin creating your own custom code.  The code will create a Journal record with 2 Journal Line Items and return a list of the draft Journal created. The following steps will be performed:

    1. Prepare the list collection “List<JournalWrapper>” to supply as an input for the CreateJournals function.
    2. Prepare the list collection “List<JournalLineWrapper>” to insert Journal Line Items with their required fields.
    3. Create the Journal and Journal Line Item Records
    4. Return a list of the draft Journal created with the list “listOfJournalRequest”

     

    Sample Code :

    /**************Start Sample Code Create A Draft Journal *****************************/
    
    // Create a new variable Journal Wrapper to store the Journal data
    zumzum.JournalWrapper objJournal = new zumzum.JournalWrapper();
    
    // Create a new list variable to store the Journal Line Wrappers
    
    List<zumzum.JournalLineWrapper> listOfLines = new List<zumzum.JournalLineWrapper>();
    
    // Create a new variable JournalLineWrapper to store the journal line data
    
    zumzum.JournalLineWrapper objJornalLine = new zumzum.JournalLineWrapper();
    
    // Add the Nominal Account ID data to the Journal Line item variables
    
    objJornalLine.NominalAccount ='a0i3H00000000NdQAI';
    
    // Add the Tax Rate ID data to the Journal Line item variables 
    
    objJornalLine.TaxRate ='a173H0000008OcZQAU';
    
    // Add the Debit amount data to the Journal Line item variables 
    
    objJornalLine.Debit = 10.00;
    
    //Add the Journal Line Item to the Journal Line Items Wrapper
    
    listOfLines.add(objJornalLine);
    
    // Create a new variable JournalLineWrapper to store the journal line data 
    
    objJornalLine = new zumzum.JournalLineWrapper();
    
    // Add the Nominal Account ID data to the Journal Line item variables 
    
    objJornalLine.NominalAccount ='a0i3H00000000NdQAI';
    
    // Add the Tax Rate ID data to the Journal Line item variables 
    
    objJornalLine.TaxRate ='a173H0000008OcZQAU';
    
    // Add the Credit amount data to the Journal Line item variables 
    
    objJornalLine.Credit = 10;
    
    //Add the Journal Line Item to the Journal Line Items Wrapper 
    
    listOfLines.add(objJornalLine);
    
    objJournal.JournalLines = listOfLines;
    
    // Create the variable to store the list of Journal Wrappers
    
    List<zumzum.JournalWrapper> listOfJournalRequest = new List<zumzum.JournalWrapper>();
    
    // Add the journal to the list of Journal Wrappers
    
    listOfJournalRequest.add(objJournal);
    
    // Initiate a new instance of the Zumzum Journal Service
    
    zumzum.JournalService objJournalService = new zumzum.JournalService();
    
    // Call the CreateJournals method in the Journal Service
    
    zumzum.JournalService.JournalResponse response = objJournalService.CreateJournals(listOfJournalRequest);
    
    // Receive the response message from the Journal Service
    
    system.debug('Response>>' + response); 
    
    /**************Start Sample Code Create A Draft Journal *****************************/

    Edit A Draft Journal – UpdateJournals Method

    Below is information related on how to edit a draft Journal with the Journal API service using Apex code.   The UpdateJournals method is used to edit Journals and Journal Line Items and returns a list of draft Journals edited.

    Global Class Name Method Input Output
    JournalService UpdateJournals List “JournalWrapper” List “JournalService.JournalResponse”

    Sample Code: Update Journal

    This example code us used to edit an existing Journal record, to help you begin creating your own custom code.  The code will edit the Journal Line Item of an existing Journal. The following steps will be performed:

    1. Prepare the list collection “List<JournalWrapper>” to include the “JournalID” to supply as an input for the UpdateJournals function.
    2. Prepare the list collection “List<JournalLineWrapper>” to edit Journal Line Items with their changed fields.
    3. Edit the Journal Line Item Records
    4. Return a list of the draft Journal edited with the list “listOfJournalRequest”

    Sample Code :

    /* Update Journal */
    
    zumzum.JournalWrapper objJournal = new zumzum.JournalWrapper();
    
    objJournal.JournalID = 'a3S3H00000003OtUAI';
    
    List<zumzum.JournalLineWrapper> listOfLines = new List<zumzum.JournalLineWrapper>();
    
    zumzum.JournalLineWrapper objJournalLine = new zumzum.JournalLineWrapper();
    
    objJournalLine.JournalLineID = 'a3R3H0000004GNMUA2';
    
    objJournalLine.NominalAccount ='a0i3H00000000NdQAI';
    
    objJournalLine.TaxRate ='a173H0000008OcZQAU';
    
    objJournalLine.Debit = 20;
    
    objJournalLine.Credit = 20;
    
    listOfLines.add(objJournalLine);
    
    objJournal.JournalLines = listOfLines;
    
    List<zumzum.JournalWrapper> listOfJournalRequest = new List<zumzum.JournalWrapper>();
    
    listOfJournalRequest.add(objJournalLine);
    
    zumzum.JournalService objJournalService = new zumzum.JournalService();
    
    zumzum.JournalService.JournalResponse response = objJournalService.UpdateJournals(listOfJournalRequest);
    
    system.debug('Response>>' + response);

     

    Post A Journal – PostJournal Method

    Below is information related on how to Post a draft Journal with the Journal API service using Apex code.  Zumzum Financials includes a global class called JournalService which you may call from your own Apex code. The PostJournal method is used to change the status of a draft Journal and create general ledger records to update your financial reports in Zumzum Financials.

    Global Class Name Method Input Output
    JournalService PostJournal String “JournalID” List “JournalService.JournalResponse”

    Sample Code: Post A Journal

    Please follow the below steps to post a single Journal record.

    1. Prepare the input variable “JournalID to submit to the PostJournal method.
    2. You may develop your own batch routine to submit multiple Journals to the PostJournal method.

    This example is provided to help you begin creating your own custom code.  The code will post a Journal to the general ledger.

    Sample Code:

    /* Post Journal */
    
    zumzum.JournalService objService = new zumzum.JournalService();
    
    zumzum.JournalService.JournalResponse response = objService.PostJournal('a0Z7E0000097UA7UAM');
    
    system.debug('response>>' + response);

    Unpost A Journal – UnpostJournal Method

    Below is information related on how to Unpost a Journal with the Journal API service using Apex code.  Zumzum Financials includes a global class called JournalService which you may call from your own Apex code. The UnpostJournal method is used to remove the ledger records of a posted Journal and set the status of the Journal record to Draft.

    Global Class Name Method Input Output
    JournalService UnpostJournal String “JournalID” List “JournalService.JournalResponse”

    Sample Code: Unpost A Journal

    Please follow the below steps to Unpost a single Journal record.

    1. Prepare the input variable “JournalID to submit to the UnpostJournal method.
    2. You may develop your own batch routine to submit multiple Journals to the UnpostJournal method.

    This example is provided to help you begin creating your own custom code.  The code will unpost a Journal and remove the associated general ledger entries.

    Sample Code:

    /* Unpost Journal */
    
    zumzum.JournalService objService = new zumzum.JournalService();
    
    zumzum.JournalService.JournalResponse response = objService.UnPostJournal('a3S3H00000003OtUAI');
    
    system.debug('response>>' + response);
    
    Below are a list of error codes that are returned by the Journal Service.

     

    Supported Error Codes – Journal Service (API)

    Error Message Reason Resolution
    “Error : Provide Nominal Account first” Creating a Journal Line Item without specifying a Nominal Account. Pass the Nominal Account ID with the Journal Line Item details.
    “Error: Provide Tax Rate” Creating a Journal Line Item without specifying a Tax Rate. Pass the Tax Rate ID with the Journal Line Item details.
    “Error: You can not perform Debit and Credit at once” Both Debit and Credit values are being passed to the Journal Line Item. Only enter the ForeignDebit or ForeignCredit values not both on the Journal Line Item.
    “Error: Please make sure that the Dimension is “Active” and “Type” Dimension 2.” Creating a Journal Line item with a dimension which is inactive or set for a type of different dimension (e.g. entering Dimension 2 into Dimension 1 field) Check that your Dimension is “Active” and/or that you are passing the correct Dimension “Type” to the correct Dimension field.
    “Error : Provide Journal line record id” You have attempted to edit a draft journal and add a new line item or you have attempted to edit an existing Journal Line without passing the JournalLineItemID Please delete your current Journal record and create a new Journal record with the appropriate line items added.
    “Error: Journal can not be posted as it is not in draft mode” You have attempted to post a Journal which is already posted. Check that you are passing the correct Journal ID to the PostJournal method.
    “Error: The Journal’s Entry is not balanced” You have attempted to post a Journal where Debits and Credits do net to a balance of zero. Please ensure your Journal balance is 0.00 before submitting the JournalID to the PostJournal service.
    “Response>>JournalResponse:[ResponseMessage=Exception occured – Update failed. First exception on row 0 with id a0Z8E000004IA2HUAW; first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, Zumzum.JournalProcessing: execution of AfterUpdate caused by: System.NullPointerException: Attempt to de-reference a null object Trigger.Zumzum.JournalProcessing: line 92, column 1: [] at line 25, journalsList=()]” You have attempted to post a Journal with no line items Ensure your Journal has Journal Line Items added correctly, prior to submitting to the PostJournal Service. You may need to remove and re create the Journal in order to reach your desired Journal lines.
    “Error: This Journal is not Posted to Ledger” The Journal you have attempted to UnPost is already in Draft status. Check that you are passing the correct JournalID to the UnpostJournal method.
    “Error:No Journal Line Items found, please provide a list of Journal Line items to save this transaction” You have attempted to edit a journal line item without providing the list of line items. Pass the necessary variables in the JournalLineWrapper.
    You have attempted to post a transaction which is prior to the “Lock Date” set in Zumzum Financials.

    Please ensure your date is greater than the \”Lock Date\” set by your administrator

    The date you are using for the journal when posting is prior to the Account Lock Date. Please ask your Zumzum Financials administrator to change the Account Lock Date or change the posting date of your Journal to be greater than the Account Lock Date.
    This transactions is earlier than your “Lock Date” so may not be unposted.’
    Post a reversing transaction or a new transaction to update your general ledger.
    Please contact your administrator for further assistance.
    The Journal is posted prior to the Account Lock Date set in Zumzum Financials. Please ask your Zumzum Financials administrator to change the Account Lock Date. Alternatively, post a new Journal to reverse the previous Journal, with a date greater than the Account Lock Date.
    in Journal API Tags: APIIntegrationJournal

    Related Articles