Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Sage_WFM_API_JournalHelper_1_0

Marcus Corner edited this page Dec 9, 2015 · 1 revision

Overview

This helper class provides two methods for working with the Payroll journal api. One to retrieve the Accounts (Sage Live Tags on a Mapping Dimension) for mapping in the Payroll system, and one to send/post journal data from the payroll system to be created as a journal in Sage Live.

Methods & Examples

GetPayrollAccounts
input Sage_WFM_API_Reference_1_0 **Dimension** Alternatively, a reference to the dimension containing the mapping tags can be supplied. The tags linked to the dimension will be returned. Dimensions can be obtained using the Sage_API_Dimension_Helper_1_0.
output Sage_WFM_API_PayrollAccountData_1_0 The output will return the tags to be used as accounts for mapping in the Payroll system.

The following example will retrieve the Accounts for the 'Payroll Integration' dimension.

s2cor.Sage_API_Reference_1_0 dimension = 
    new s2cor.Sage_API_Reference_1_0(null, 'Payroll Integration', null);
Sage_WFM_API_PayrollAccountData_1_0 accountData = 
    Sage_WFM_API_JournalHelper_1_0.GetPayrollAccounts(null, dimension);
for(Sage_WFM_API_PayrollAccountData_1_0.AccountItem acc : accountData.Items)
{
    system.debug(acc.Code);
}
**CreateJournal**
input Sage_WFM_API_PayrollJournalData_1_0 **Data** The data to be used to create the journal..
input Boolean **VerifyOnly** If true, the input data will be verified, but the journal will NOT be created..
output Sage_WFM_API_JournalResponse_1_0 The output will return the details of the journal created.

The following example will create a simple journal.

Sage_WFM_API_PayrollJournalData_1_0 data = 
    new Sage_WFM_API_PayrollJournalData_1_0();
data.Header.PostingDate = '2015-10-10';
data.Header.Company = 
    new s2cor.Sage_API_Reference_1_0(null, 'My Company Name', null);

Sage_WFM_API_PayrollJournalData_1_0.JournalLine line = 
    new Sage_WFM_API_PayrollJournalData_1_0.JournalLine();
line.Amount = 100;
line.Code = 'Earnings';
Sage_WFM_API_PayrollJournalData_1_0.TagRef tag = 
    new Sage_WFM_API_PayrollJournalData_1_0.TagRef();
tag.Dimension = 'Department';
tag.Value = 'R&D';
line.tags.Add(tag);
data.Lines.Add(line);

Sage_WFM_API_JournalResponse_1_0 response = 
  Sage_WFM_API_JournalHelper_1_0.CreateJournal(data, false);
Clone this wiki locally