Accounting Apex API Developer Reference

c2g.AllocationsService

global with sharing class AllocationsService

the service class relating to allocations.

Enums

DateRangeType

Indicates whether the allocation process will select transactions using a date range or a period range.

Value Description
DateRange By date range (FromDate and ToDate) on the allocation template.
PeriodRange By period range (FromPeriodId and ToPeriodId) on the allocation template.

SoftDateRangeType

SoftPeriodRangeType

BasisType

The list of valid basis types.

Value Description
Statistical The allocation is created by selecting statistical basis.

CopyGla

The list of valid places you can copy GLAs from to use in the allocation.

Value Description
FromSource The GLAs specified in the source data are used.
FromBasis The GLAs specified in the statistical basis used for this allocation are used.

DistributionField

The list of valid distribution fields.

Value Description
Company Statistical values are distributed by Company.
GeneralLedgerAccount Statistical values are distributed by GeneralLedgerAccount.
Dimension1 Statistical values are distributed by Dimension1.
Dimension2 Statistical values are distributed by Dimension2.
Dimension3 Statistical values are distributed by Dimension3.
Dimension4 Statistical values are distributed by Dimension4.

AllocationMethod

The list of valid allocation methods.

Value Description
Fixed The allocation is created by a fixed allocation rule or by manual allocation.
Variable The allocation is created by a variable allocation rule or by selecting a statistical basis.

AllocationItem

The list of valid allocation items.

Value Description
Transaction The allocation is created for transactions.

FilterStructureType

The list of valid filter structure types. Set the FilterStructureType of the filter structure with the field values of this enumeration.

Value Description
Company Company value
Dimension1 Dimension1 value.
Dimension2 Dimension2 value.
Dimension3 Dimension3 value.
Dimension4 Dimension4 value.
GeneralLedgerAccount General Ledger Account value.
Period Accounting period value.
Account Account value.

DefaultFilterCriteria

The list of valid default filter criteria types.

Value Description
EqualsValue Enables you to select a single value. When this type is selected, the value must be unique.
FromToValue Enables you to select a range of values.
MultiselectValue Enables you to select multiple values.

FilterFor

The list of valid default filter for values.

Value Description
DistributeToGla Enables you to select the individual GLAs you want to allocate to.

FilterCriteria

The list of valid filter criteria types.

Value Description
EqualsValue Enables you to select a single value for the filter.
FromValue Enables you to select a From value for a range.
MultiselectValue This type indicates that the value will be used on the filter as the multi-select value. You could filter the object by more than one record.
ToValue Enables you to select a To value for a range.

GLADistribution

The list of GLA distribution options.

Value Description
Manual Select the distribution GLAs manually.
FromSource Copy the source GLAs.
FromBasis Copy the GLAs from the associated statistical basis.

FilterOperator

The list of valid filter operators.

Value Description
Equals Equals Value
NotEquals Not Equals Value
Contains Contains Value

DistributionFields

The list of valid distribution field types.

Value Description
GeneralLedgerAccount Enables you to select General Ledger Account as the distribution field.
Dimension1 Enables you to select Dimension 1 as the distribution field.
Dimension2 Enables you to select Dimension 2 as the distribution field.
Dimension3 Enables you to select Dimension 3 as the distribution field.
Dimension4 Enables you to select Dimension 4 as the distribution field.

DestinationType

The list of valid destination types. These are the document types that the Allocation process creates.

Value Description
Journals The process will create a journal.
Transactions The process will create a transaction. This is the default.

AllocationType

The list of valid allocation types. These are the allocation types that the Allocation process creates.

Value Description
Fixed Allocation is of fixed type. This is the default.
Statistical Allocation is of variable type.

Methods

getFiltersWithValues

global static List<c2g.AllocationsService.FilterDataStructure> getFiltersWithValues(List<c2g.AllocationsService.RefineFilterStructure> refineFilterStructureList)

This method returns the reference values that contain the ID and Name.

Input Parameters

Name Type Description
refineFilterStructureList List<c2g.AllocationsService.RefineFilterStructure> A list of RefineFilterStructures

Return Value

This service returns a list of c2g.AllocationsService.FilterDataStructure objects

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<AllocationsService.FilterDataStructure> filterDataStructureList = c2g.AllocationsService.getFiltersWithValues( new 
List<c2g.AllocationsService.RefineFilterStructure>{ new 
c2g.AllocationsService.RefineFilterStructure('c2g__codaGeneralLedgerAccount__c', '', null) } );

retrieve

global static c2g.AllocationsService.RetrieveStructure retrieve(c2g.AllocationsService.Template template)

Retrieves a RetrieveStructure with the required information to create Allocation Transaction Line Items. For example, Company, General Ledger Accounts and Dimensions.

Input Parameters

Name Type Description
template c2g.AllocationsService.Template The information necessary to filter the transaction line items in the retrieve process.

Return Value

This service returns a c2g.AllocationsService.RetrieveStructure object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.Template template = new c2g.AllocationsService.Template();
template.Id = 'a04240000008ALi';
template.ToDate = system.today();
c2g.AllocationsService.RetrieveStructure retrieveStr = c2g.AllocationsService.retrieve(template);

createAllocations

global static List<Id> createAllocations(List<c2g.AllocationsService.AllocationsStructure> allocationsStructureList)

This method creates the allocation transaction or journal based on an AllocationStructure created by the developer. Use ManageAllocations (Manage Allocations) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
allocationsStructureList List<c2g.AllocationsService.AllocationsStructure> Holds a list of AllocationsStructures.

Return Value

A list of Id objects. This will be Journal Ids or Transaction Ids, depending on the chosen Destination Type.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.RetrieveData retrieveData1 = new c2g.AllocationsService.RetrieveData();
retrieveData1.GeneralLedgerAccountId = 'a1Lw00000020For';
retrieveData1.Dimension1Id = 'a1Cw00000002w45';
retrieveData1.Dimension2Id = 'a1Dw0000001BIuj';
retrieveData1.Dimension3Id = 'a1Ew000000Io7j6';
retrieveData1.Dimension4Id = 'a1Fw00000014wzA';
retrieveData1.TransactionLineItemsSumValue = 100;
c2g.AllocationsService.SplitData splitData1 = new c2g.AllocationsService.SplitData();
splitData1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitData1.Dimension1Id = 'a1Cw00000002w45';
splitData1.Dimension2Id = 'a1Dw0000001BIuj';
splitData1.Amount = 25;
c2g.AllocationsService.SplitData splitData2 = new c2g.AllocationsService.SplitData();
splitData2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitData2.Dimension3Id = 'a1Ew000000Io7j6';
splitData2.Dimension4Id = 'a1Fw00000014wzA';
splitData2.Amount = 75;
c2g.AllocationsService.AllocationsStructure allocationStr = new c2g.AllocationsService.AllocationsStructure();
allocationStr.RetrieveDataList = new List<c2g.AllocationsService.RetrieveData> {retrieveData1};
allocationStr.SplitDataList = new List<c2g.AllocationsService.SplitData>{splitData1, splitData2};
allocationStr.AllocationsDate = System.today();
allocationStr.PeriodId = 'a1uw0000001Kd6l';
List<Id> transactionIdList = c2g.AllocationsService.createAllocations(new List<c2g.AllocationsService.AllocationsStructure> {allocStructure});

createAllocationsWithBatch

global static List<Id> createAllocationsWithBatch(List<c2g.AllocationsService.AllocationsStructure> allocationsStructureList)

This method creates the allocation transaction or journal based on an AllocationStructure created by the developer. Allocations with higher volumes will be processed in batch. All limits are defined in codaDocumentLineVolumeSettings__c. Journal limits are defined by the ManualJournalLinesLimit__c field, and Transactions are defined by the AllocationBatchLinesLimit__c field. Use ManageAllocations (Manage Allocations) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
allocationsStructureList List<c2g.AllocationsService.AllocationsStructure> Holds a list of AllocationsStructures.

Return Value

A list of Id objects. If batch is not used because line limits were not reached, this will be Journal Ids or Transaction Ids, depending on the chosen Destination Type. If batch is used due to high volumes, this will be Allocation Ids.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.RetrieveData retrieveData1 = new c2g.AllocationsService.RetrieveData();
retrieveData1.GeneralLedgerAccountId = 'a1Lw00000020For';
retrieveData1.Dimension1Id = 'a1Cw00000002w45';
retrieveData1.Dimension2Id = 'a1Dw0000001BIuj';
retrieveData1.Dimension3Id = 'a1Ew000000Io7j6';
retrieveData1.Dimension4Id = 'a1Fw00000014wzA';
retrieveData1.TransactionLineItemsSumValue = 100;
c2g.AllocationsService.SplitData splitData1 = new c2g.AllocationsService.SplitData();
splitData1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitData1.Dimension1Id = 'a1Cw00000002w45';
splitData1.Dimension2Id = 'a1Dw0000001BIuj';
splitData1.Amount = 25;
c2g.AllocationsService.SplitData splitData2 = new c2g.AllocationsService.SplitData();
splitData2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitData2.Dimension3Id = 'a1Ew000000Io7j6';
splitData2.Dimension4Id = 'a1Fw00000014wzA';
splitData2.Amount = 75;
c2g.AllocationsService.AllocationsStructure allocationStr = new c2g.AllocationsService.AllocationsStructure();
allocationStr.RetrieveDataList = new List<c2g.AllocationsService.RetrieveData> {retrieveData1};
allocationStr.SplitDataList = new List<c2g.AllocationsService.SplitData>{splitData1, splitData2};
allocationStr.AllocationsDate = System.today();
allocationStr.PeriodId = 'a1uw0000001Kd6l';
List<Id> transactionIdList = c2g.AllocationsService.createAllocations(new List<c2g.AllocationsService.AllocationsStructure> {allocStructure});

saveTemplates

global static List<Id> saveTemplates(List<c2g.AllocationsService.Template> templateList)

This method saves a list of templates. This method also deletes the existing record and creates a new one with the old and new values. Use ManageAllocations (Manage Allocations) custom permission to grant permissions on this method.

Input Parameters

Name Type Description
templateList List<c2g.AllocationsService.Template> Holds a list of AllocationsStructures.

Return Value

This service a list of Id objects.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.Filter filter1 = new c2g.AllocationsService.Filter();
filter1.FilterCriteria = c2g.AllocationsService.FilterCriteria.MultiselectValue;
filter1.Values = new List<Object> {'a1Cw00000002w45'};
c2g.AllocationsService.FilterStructure filterStr1 = new c2g.AllocationsService.FilterStructure();
filterStr1.FilterPosition = 1;
filterStr1.FilterStructureType = c2g.AllocationsService.FilterStructureType.Dimension1;
filterStr1.DefaultFilterCriteria = c2g.AllocationsService.DefaultFilterCriteria.MultiselectValue;
filterStr1.FilterList = new List<c2g.AllocationsService.Filter>{filter1};
c2g.AllocationsService.SplitStructure splitStr1 = new c2g.AllocationsService.SplitStructure();
splitStr1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr1.Dimension1Id = 'a1Cw00000002w45';
splitStr1.Percentage = 20;
c2g.AllocationsService.SplitStructure splitStr2 = new c2g.AllocationsService.SplitStructure();
splitStr2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr2.Dimension1Id = 'a1Cw00000002w45';
splitStr2.Percentage = 80;
c2g.AllocationsService.Template template = new c2g.AllocationsService.Template();
template.Name = 'Template1';
template.Description = 'Template Description';
template.FilterStructureList = new List<c2g.AllocationsService.FilterStructure> {filterStr1};
template.SplitStructureList = new List<c2g.AllocationsService.SplitStructure> {splitStr1, splitStr2};
List<id> templateId = c2g.AllocationsService.saveTemplates( new List<c2g.AllocationsService.Template> {template} );

loadTemplates

global static List<c2g.AllocationsService.Template> loadTemplates(Set<Id> templateIds)

This method creates the allocation transaction or journal based on an AllocationStructure created by the developer.

Input Parameters

Name Type Description
templateIds Set<Id> List of templates.

Return Value

This service returns a list of Id objects.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<c2g.AllocationsService.Template> templateList = c2g.AllocationsService.loadTemplates(new Set<id> {'a04240000008ALi'});

calculateSplitStructureLinesForFixedAllocation

global static Map<Id, List<c2g.AllocationsService.SplitStructure>> calculateSplitStructureLinesForFixedAllocation(Set<Id> ruleIds)

This method calculates the Split Structure lines from rule Ids.

Input Parameters

Name Type Description
ruleIds Set<Id> List of fixed allocation rule Ids.

Return Value

This service returns a map of Id, c2g.AllocationsService.SplitStructure objects.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

Map<Id, List<c2g.AllocationsService.SplitStructure>> splitStructureMap = c2g.AllocationsService.calculateSplitStructureLinesForFixedAllocation(new Set<id> {'a04240000008ALi'});

calculateSplitDataLinesForStatisticalAllocation

global static List<c2g.AllocationsService.SplitData> calculateSplitDataLinesForStatisticalAllocation(c2g.AllocationsService.RuleBasedStatisticalAllocation ruleBasedStatisticalAllocation)

This method calculates the Split Data lines from rule based statistical allocation.

Input Parameters

Name Type Description
ruleBasedStatisticalAllocation c2g.AllocationsService.RuleBasedStatisticalAllocation Holds an object of c2g.AllocationsService.RuleBasedStatisticalAllocation.

Return Value

This service returns a list of c2g.AllocationsService.SplitData objects.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.RuleBasedStatisticalAllocation ruleBasedStatisticalAllocation = new c2g.AllocationsService.RuleBasedStatisticalAllocation();
ruleBasedStatisticalAllocation.RuleId = 'a04240000008ALi';
ruleBasedStatisticalAllocation.GlaIds = new Set<Id>{'a1Lw00000020For','a1Lw00000030For'};
ruleBasedStatisticalAllocation.Amount = 33.33;
List<c2g.AllocationsService.SplitData> splitLines = c2g.AllocationsService.calculateSplitDataLinesForStatisticalAllocation(c2g.AllocationsService.RuleBasedStatisticalAllocation ruleBasedStatisticalAllocation);

calculateSplitDataLinesForStatisticalAllocation

global static List<c2g.AllocationsService.SplitData> calculateSplitDataLinesForStatisticalAllocation(c2g.AllocationsService.StatisticalBasisAllocation statisticalBasisAllocation)

This method calculates the Split Data lines from statistical basis allocation.

Input Parameters

Name Type Description
statisticalBasisAllocation c2g.AllocationsService.StatisticalBasisAllocation Holds an object of c2g.AllocationsService.StatisticalBasisAllocation.

Return Value

This service returns a list of c2g.AllocationsService.SplitData objects.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.StatisticalFilter statisticalFilter = new c2g.AllocationsService.StatisticalFilter();
statisticalFilter.Id = 'b24240000356ALi';
statisticalFilter.FilterField = 'General Ledger Account';
statisticalFilter.Operator = 'Contains';
statisticalFilter.Value = 'Apex';

c2g.AllocationsService.StatisticalFilter statisticalFilter1 = new c2g.AllocationsService.StatisticalFilter();
statisticalFilter1.Id = 'b24240000365ALi';
statisticalFilter1.FilterField = 'Dimension 1';
statisticalFilter1.Operator = 'Equals';
statisticalFilter1.Value = 'Dim 1';

List<c2g.AllocationsService.StatisticalFilter> statisticalFilters = new List<c2g.AllocationsService.StatisticalFilter>{statisticalFilter, statisticalFilter1};

c2g.AllocationsService.StatisticalBasisAllocation statisticalBasisAllocation = new c2g.AllocationsService.StatisticalBasisAllocation();
statisticalBasisAllocation.BasisName = 'Statistical Basis Name';
statisticalBasisAllocation.DistributionFields = new List<String>{'General Ledger Account','Dimension 1','Dimension 2','Dimension 3','Dimension 4'};
statisticalBasisAllocation.DistributionFieldFilters = statisticalFilters;
statisticalBasisAllocation.GlaIds = new Set<Id>{'a1Lw00000020For','a1Lw00000030For'};
statisticalBasisAllocation.Amount = 33.33;
List<c2g.AllocationsService.SplitData> splitLines = c2g.AllocationsService.calculateSplitDataLinesForStatisticalAllocation(c2g.AllocationsService.StatisticalBasisAllocation statisticalBasisAllocation);

calculateSplitDataLines

global static List<c2g.AllocationsService.SplitData> calculateSplitDataLines(List<c2g.AllocationsService.SplitStructure> splitStructureList, Decimal totalAmount)

This method calculates Split Data Lines from Split Structure Lines and total amount.

Input Parameters

Name Type Description
splitStructureList List<c2g.AllocationsService.SplitStructure> Holds a list of SplitStructures.
totalAmount Decimal Holds the total amount of the sum of transaction line item home values.

Return Value

This service a list of c2g.AllocationsService.SplitData objects.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.SplitStructure splitStr1 = new c2g.AllocationsService.SplitStructure();
splitStr1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr1.Dimension1Id = 'a1Cw00000002w45';
splitStr1.Dimension2Id = 'a1Dw0000001BIuj';
splitStr1.percentage= 20;
c2g.AllocationsService.SplitStructure splitStr2 = new c2g.AllocationsService.SplitStructure();
splitStr2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr2.Percentage = 80;
List<c2g.AllocationsService.SplitData> splitLines = c2g.AllocationsService.calculateSplitDataLines(new List<c2g.AllocationsService.SplitStructure>{splitStr1, splitStr2}, 33.33);

calculateSplitDataLines

global static List<c2g.AllocationsService.SplitData> calculateSplitDataLines(List<c2g.AllocationsService.SplitStructure> splitStructureList, c2g.AllocationsService.AllocationsStructure allocationsStructure)

This method calculates Split Data Lines from Split Structure Lines and Allocations Structure in single or multi-company mode.

Input Parameters

Name Type Description
splitStructureList List<c2g.AllocationsService.SplitStructure> Holds a list of SplitStructures.
allocationsStructure c2g.AllocationsService.AllocationsStructure Used to calculate the total amount of the sum of transaction line item values. It sums the home values when only one company is selected, and as current and dual values otherwise.

Return Value

This service returns a list of c2g.AllocationsService.SplitData objects.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.SplitStructure splitStructure1 = new c2g.AllocationsService.SplitStructure();
splitStructure1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStructure1.Dimension1Id = 'a1Cw00000002w45';
splitStructure1.Dimension2Id = 'a1Dw0000001BIuj';
splitStructure1.percentage= 20;

c2g.AllocationsService.SplitStructure splitStructure2 = new c2g.AllocationsService.SplitStructure();
splitStructure2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStructure2.Percentage = 80;

List<c2g.AllocationsService.SplitStructure> splitStructureList = new List<c2g.AllocationsService.SplitStructure>{splitStructure1,splitStructure2};

c2g.AllocationsService.RetrieveData retrieveData = new c2g.AllocationsService.RetrieveData();
retrieveData.GeneralLedgerAccountId = 'a1Lw00000020For';
retrieveData.Dimension1Id = 'a1Cw00000002w45';
retrieveData.Dimension4Id = 'a1Dw0000001BIuj';
retrieveData.TransactionLineItemsSumValue = 10000;
List<c2g.AllocationsService.RetrieveData> retrieveDataList = new List<c2g.AllocationsService.RetrieveData>{retrieveData};

c2g.AllocationsService.AllocationsStructure allocationsStructure = new c2g.AllocationsService.AllocationsStructure();
allocationsStructure.RetrieveDataList = retrieveDataList;

List<c2g.AllocationsService.SplitData> splitDataList = c2g.AllocationsService.calculateSplitDataLines(splitStructureList, allocationsStructure);

c2g.AllocationsService.RefineFilterStructure

global class RefineFilterStructure

holds the filters to retrieve the lookup values.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.RefineFilterStructure refineFilterStructure = new c2g.AllocationsService.RefineFilterStructure();
refineFilterStructure.ObjectAPIName = 'codaGeneralLedgerAccount__c';
refineFilterStructure.RefineSearch = 'Accounts';

Properties

Name Type Description
ObjectAPIName String objectapiname the object api name to query the records on base data. for example: "codageneralledgeraccount__c".
RefineSearch String refinesearch the word to filter the names of the records. for example: "accounts" for "codageneralledgeraccount__c".
CompanyId Id companyid the company id takes into account when the object belongs to a company.

Methods

RefineFilterStructure

global RefineFilterStructure()

RefineFilterStructure

global RefineFilterStructure(String objectAPIName, String refineSearch, Id companyId)

Holds the filters to get the lookup values.

Input Parameters

Name Type Description
objectAPIName String The object API name to query the records on base data. For example, "codaGeneralLedgerAccount__c".
refineSearch String The word to filter the names of the records. For example, "Accounts" for "codaGeneralLedgerAccount__c".
companyId Id The company ID.

Return Value

This constructor does not return a value.

hasObjectAPIName

global Boolean hasObjectAPIName()

Determines if the ObjectAPIName has been populated in the RefineFilterStructure.

Return Value

This service returns a Boolean object.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.RefineFilterStructure refineFilterStructure = new c2g.AllocationsService.RefineFilterStructure();
refineFilterStructure.ObjectAPIName = 'codaGeneralLedgerAccount__c';
System.assertEquals(true, refineFilterStructure.hasObjectAPIName());

c2g.AllocationsService.FilterDataStructure

global class FilterDataStructure

holds a list of entities and the default entity value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<AllocationsService.FilterDataStructure> filterDataStructureList = c2g.AllocationsService.getFiltersWithValues( new 
List<c2g.AllocationsService.RefineFilterStructure>{ new 
c2g.AllocationsService.RefineFilterStructure('c2g__codaGeneralLedgerAccount__c', '', null) } );

Properties

Name Type Description
DefaultEntityValue c2g.AllocationsService.EntityValue the default value of the list
FilterDataList List<c2g.AllocationsService.EntityValue> a list of entities.

Methods

FilterDataStructure

global FilterDataStructure()

FilterDataStructure

global FilterDataStructure(c2g.AllocationsService.EntityValue defaultEntityValue, List<c2g.AllocationsService.EntityValue> filterDataList)

Holds a list of entities as well as the default entity value.

Input Parameters

Name Type Description
defaultEntityValue c2g.AllocationsService.EntityValue The default value of the list.
filterDataList List<c2g.AllocationsService.EntityValue> A list of entities.

Return Value

This constructor does not return a value.

c2g.AllocationsService.RetrieveStructure

global class RetrieveStructure

holds the company id and required information to create allocation transaction line items grouped by general ledger accounts and dimensions.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

List<c2g.AllocationsService.Template> templateList = c2g.AllocationsService.loadTemplates(new Set<id> {'a04240000008ALi'});
c2g.AllocationsService.RetrieveStructure retrieveStr = c2g.AllocationsService.retrieve(templateList[0]);
Decimal totalAmount = 0;
for (c2g.AllocationsService.RetrieveData retrieveData : retrieveStr.RetrieveDataList)
{
    totalAmount += retrieveData.TransactionLineItemsSumValue;
}
List<c2g.AllocationsService.SplitData> splitDataList = c2g.AllocationsService.calculateSplitDataLines(templateList[0].SplitStructureList, totalAmount);
c2g.AllocationsService.AllocationsStructure allocationStr = new c2g.AllocationsService.AllocationsStructure();
allocationStr.RetrieveDataList = retrieveStr.RetrieveDataList;
allocationStr.SplitDataList = splitDataList;
allocationStr.AllocationsDate = System.today();
List<Id> transactionIdList = c2g.AllocationsService.createAllocations( new List<c2g.AllocationsService.AllocationsStructure>{allocationStr} );

Properties

Name Type Description
CompanyInfo c2g.AllocationsService.CompanyData the companydata.
RetrieveDataList List<c2g.AllocationsService.RetrieveData> a list of retrievedata.

Methods

RetrieveStructure

global RetrieveStructure()

RetrieveStructure

global RetrieveStructure(c2g.AllocationsService.CompanyData companyInfo, List<c2g.AllocationsService.RetrieveData> retrieveDataList)

Retrieves a RetrieveStructure with the required information to create Allocation Transaction Line Items. For example, Company, General Ledger Accounts and Dimensions.

Input Parameters

Name Type Description
companyInfo c2g.AllocationsService.CompanyData The values for CompanyData.
retrieveDataList List<c2g.AllocationsService.RetrieveData> Holds a list of RetrieveData.

Return Value

This constructor does not return a value.

c2g.AllocationsService.Entities

global abstract class Entities

holds general ledger accounts (entityvalue), with dimensions 1 to 4 (entityvalue). you can only populate the general ledger account or general ledger account and dimensions. the general ledger account is mandatory.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.Entities entities = new c2g.AllocationsService.Entities();
entities.GeneralLedgerAccountId = 'a1Lw00000020For';
entities.Dimension1Id = 'a1Cw00000002w45';
entities.Dimension2Id = 'a1Dw0000001BIuj';
entities.Dimension3Id = 'a1Ew000000Io7j6';
entities.Dimension4Id = 'a1Fw00000014wzA';

Properties

Name Type Description
id Id the record id of the entity
GeneralLedgerAccountId Id the id of the general ledger account.
Dimension1Id Id the id of dimension 1.
Dimension2Id Id the id of dimension 2.
Dimension3Id Id the id of dimension 3.
Dimension4Id Id the id of dimension 4.

Methods

Entities

global Entities()

Entities

global Entities(Id generalLedgerAccountId, Id dimension1Id, Id dimension2Id, Id dimension3Id, Id dimension4Id)

CHolds a general ledger EntityValue and may have Dimension1, 2, 3 or 4 EntityRetrieveValue.

Input Parameters

Name Type Description
generalLedgerAccountId Id The ID of the general ledger account.
dimension1Id Id The ID of the Dimension 1.
dimension2Id Id The ID of the Dimension 2.
dimension3Id Id The ID of the Dimension 3.
dimension4Id Id The ID of the Dimension 4.

Return Value

This constructor does not return a value.

c2g.AllocationsService.RetrieveData

global with sharing class RetrieveData extends Entities implements IConvertToJournalLineItem, IConvertToTransactionLineItem

holds the same fields as the entities class as well as the sum of homevalues.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.RetrieveData retrieveData1 = new c2g.AllocationsService.RetrieveData();
retrieveData1.GeneralLedgerAccountId = 'a1Lw00000020For';
retrieveData1.Dimension1Id = 'a1Cw00000002w45';
retrieveData1.Dimension2Id = 'a1Dw0000001BIuj';
retrieveData1.Dimension3Id = 'a1Ew000000Io7j6';
retrieveData1.Dimension4Id = 'a1Fw00000014wzA';
retrieveData1.TransactionLineItemsSumValue = 100;

c2g.AllocationsService.SplitData splitData1 = new c2g.AllocationsService.SplitData();
splitData1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitData1.Dimension1Id = 'a1Cw00000002w45';
splitData1.Dimension2Id = 'a1Dw0000001BIuj';
splitData1.Amount = 25;

c2g.AllocationsService.SplitData splitData2 = new c2g.AllocationsService.SplitData();
splitData2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitData2.Dimension3Id = 'a1Ew000000Io7j6';
splitData2.Dimension4Id = 'a1Fw00000014wzA';
splitData2.Amount = 75;

c2g.AllocationsService.AllocationsStructure allocationStr = new c2g.AllocationsService.AllocationsStructure();
allocationStr.RetrieveDataList = new List<c2g.AllocationsService.RetrieveData> {retrieveData1};
allocationStr.SplitDataList = new List<c2g.AllocationsService.SplitData>{splitData1, splitData2};
allocationStr.AllocationsDate = System.today();
allocationStr.PeriodId = 'a1uw0000001Kd6l';
List<Id> transactionIdList = c2g.AllocationsService.createAllocations(new List<c2g.AllocationsService.AllocationsStructure> {allocStructure});

Properties

Name Type Description
TransactionLineItemsSumValue Decimal the sum of the home values of the transaction line item, grouped by general ledger account and dimension.
CompanyId Id automatically populated by the retrieve operation when in multi-company mode.
AccountId Id

Methods

RetrieveData

global RetrieveData()

RetrieveData

global RetrieveData(Id generalLedgerAccountId, Id dimension1Id, Id dimension2Id, Id dimension3Id, Id dimension4Id, Decimal transactionLineItemsSumValue)

Holds the same fields as the Entities class and the sum of HomeValues.

Input Parameters

Name Type Description
generalLedgerAccountId Id The ID of the General Ledger Account.
dimension1Id Id The ID of Dimension 1.
dimension2Id Id The ID of Dimension 2.
dimension3Id Id The ID of Dimension 3.
dimension4Id Id The ID of Dimension 4.
transactionLineItemsSumValue Decimal The sum of the home values of the transaction line items grouped by general ledger account and dimension.

Return Value

This constructor does not return a value.

c2g.AllocationsService.SplitData

global with sharing class SplitData extends Entities implements IConvertToJournalLineItem, IConvertToTransactionLineItem

holds the same fields as the entities class as well as the split amount.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.SplitStructure splitStr1 = new c2g.AllocationsService.SplitStructure();
splitStr1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr1.Dimension1Id = 'a1Cw00000002w45';
splitStr1.Dimension2Id = 'a1Dw0000001BIuj';
splitStr1.percentage= 20;
c2g.AllocationsService.SplitStructure splitStr2 = new c2g.AllocationsService.SplitStructure();
splitStr2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr2.Percentage = 80;
List<c2g.AllocationsService.SplitData> splitLines = c2g.AllocationsService.calculateSplitDataLines(new 
List<c2g.AllocationsService.SplitStructure>{splitStr1, splitStr2}, 33.33);

Properties

Name Type Description
Amount Decimal value of the amount of the split.

Methods

SplitData

global SplitData()

SplitData

global SplitData(Id generalLedgerAccountId, Id dimension1Id, Id dimension2Id, Id dimension3Id, Id dimension4Id, Decimal amount)

Holds the same fields as the Entities class as well as the amount of the split.

Input Parameters

Name Type Description
generalLedgerAccountId Id The ID of the General Ledger Account.
dimension1Id Id The ID of Dimension 1.
dimension2Id Id The ID of Dimension 2.
dimension3Id Id The ID of Dimension 3.
dimension4Id Id The ID of Dimension 4.
amount Decimal The value of the amount of the split.

Return Value

This constructor does not return a value.

c2g.AllocationsService.EntityValue

global class EntityValue

holds the id and name of the entity.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.EntityValue entityValue = new c2g.AllocationsService.EntityValue();
entityValue.Id = 'a1Lw00000020For';
entityValue.Name = 'Sales - Parts';

Properties

Name Type Description
Id String globally unique string that identifies the record.
Name String the name of the entity.
Type String the type of the entity.

Methods

EntityValue

global EntityValue()

EntityValue

global EntityValue(String id, String name)

Holds the ID and Name.

Input Parameters

Name Type Description
id String The ID of the entity.
name String The name of the entity.

Return Value

This constructor does not return a value.

EntityValue

global EntityValue(String id, String name, String type)

Holds the ID and Name.

Input Parameters

Name Type Description
id String The ID of the entity.
name String The name of the entity.
type String The Type of the entity.

Return Value

This constructor does not return a value.

c2g.AllocationsService.CompanyData

global class CompanyData

holds the company id.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.CompanyData companyData = new c2g.AllocationsService.CompanyData();
companyData.CompanyId = 'a0m24000000cST6';

Properties

Name Type Description
CompanyId Id the company id.

Methods

CompanyData

global CompanyData()

CompanyData

global CompanyData(Id companyId)

Holds the company ID.

Input Parameters

Name Type Description
companyId Id The company ID.

Return Value

This constructor does not return a value.

c2g.AllocationsService.Template

global class Template

holds the information necessary to filter the transaction line items in the retrieve process. it is also used to save, update and load a template. Template class is referenced from both with sharing(AllocationsService) and without sharing(AllocationScheduleWorkerServiceImpl.PostWithoutSharing) contexts. c2g.AllocationsService is service class for Allocations. AllocationScheduleWorkerServiceImpl.PostWithoutSharing specifically uses without sharing in order to post schedules in different company other than user's current company. So the context behaviour of this class depends on the caller class. Therefore this class should remain in default context. CX_Ignore_Sharing

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

// Using ID
c2g.AllocationsService.Template template = new c2g.AllocationsService.Template();
template.Id = 'a04240000008ALi';
template.ToDate = system.today();
c2g.AllocationsService.RetrieveStructure retrieveStr = c2g.AllocationsService.retrieve(template);
// Using Name
c2g.AllocationsService.Template template = new c2g.AllocationsService.Template();
template.Name = 'Template 2';
template.ToDate = system.today();
c2g.AllocationsService.RetrieveStructure retrieveStr = c2g.AllocationsService.retrieve(template);

Properties

Name Type Description
Id String an existing allocation template id record.
Name String an existing allocation template name record. this field is also used by the save method to specify the name for the new template.
Description String template description.
AllocatedItem c2g.AllocationsService.AllocationItem name of the object you want to allocate.
AllocationRuleId String id of allocation rule.
AllocationMethod c2g.AllocationsService.AllocationMethod method of allocation.
DestinationCompanyId String id of the destination company.
DestinationItem c2g.AllocationsService.DestinationType type of object created as a result of the allocation process.
PostDescription String posting description.
BasisType c2g.AllocationsService.BasisType basis type used for the allocation template.
CopyGla c2g.AllocationsService.CopyGla indicates where the distribution glas should be copied from for use in the allocation template.
DistributeToGlas List<Id> used in the allocation template to specify the id of ths glas that will be distributed to.
DistributionFields List<c2g.AllocationsService.DistributionField> the fields you want to distribute to. the distribution is made using the statistical basis set on the allocation template.
StatisticalBasis String statistical basis the template is linked to.
FilterStructureList List<c2g.AllocationsService.FilterStructure> a list of filterstructures.
SplitStructureList List<c2g.AllocationsService.SplitStructure> the list of splitstructures.
StatisticalBasisFilter List<c2g.AllocationsService.StatisticalFilter> the list of statistical basis filters.
DateRangeType c2g.AllocationsService.DateRangeType select by date range or by period range.
SoftDateRangeType c2g.AllocationsService.SoftDateRangeType soft date type.
SoftPeriodRangeType c2g.AllocationsService.SoftPeriodRangeType soft period type.
NValue Integer value of n in case of soft date/period criteria.
FromDate Date the fromdate filter.
ToDate Date the todate filter.
FromPeriodId Id the fromperiodid filter.
ToPeriodId Id the toperiodid filter.
CompanyId Id the id of the corresponding company.
ICTOnly Boolean indicates that you want to retrieve only intercompany transactions. the default is false.

Methods

Template

global Template()

Template

global Template(Id id, String name, Date fromDate, Date toDate)

Holds the information necessary to filter the transaction line items in the retrieve process.

Input Parameters

Name Type Description
id Id An existing Allocation Template ID record.
name String An existing Allocation Template Name record.
fromDate Date The from date filter.
toDate Date The to date filter.

Return Value

This constructor does not return a value.

Template

global Template(Id id, String name, String description, List<c2g.AllocationsService.FilterStructure> filterStructureList, List<c2g.AllocationsService.SplitStructure> splitStructureList)

Holds the information necessary to filter the transaction line items in the retrieve process.

Input Parameters

Name Type Description
id Id An existing Allocation Template ID record.
name String An existing Allocation Template Name record.
description String An existing Allocation Template Description.
filterStructureList List<c2g.AllocationsService.FilterStructure> A list of FilterStructures.
splitStructureList List<c2g.AllocationsService.SplitStructure> A list of the SplitStructures.

Return Value

This constructor does not return a value.

c2g.AllocationsService.FilterStructure

global class FilterStructure

holds the structure of each filter set.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.Filter filter1 = new c2g.AllocationsService.Filter();
filter1.FilterCriteria = c2g.AllocationsService.FilterCriteria.MultiselectValue;
filter1.Values = new List<Object> {'a1Cw00000002w45'};
c2g.AllocationsService.FilterStructure filterStr1 = new c2g.AllocationsService.FilterStructure();
filterStr1.FilterPosition = 1;
filterStr1.FilterStructureType = c2g.AllocationsService.FilterStructureType.Dimension1;
filterStr1.DefaultFilterCriteria = c2g.AllocationsService.DefaultFilterCriteria.MultiselectValue;
filterStr1.FilterList = new List<c2g.AllocationsService.Filter>{filter1};
c2g.AllocationsService.Template template = new c2g.AllocationsService.Template();
template.ToDate = system.today();
template.FilterStructureList = new List<c2g.AllocationsService.FilterStructure> {filterStr1};
c2g.AllocationsService.RetrieveStructure retrieveStr = c2g.AllocationsService.retrieve(template);

Properties

Name Type Description
FilterStructureType c2g.AllocationsService.FilterStructureType the filter structure types.
FilterFor c2g.AllocationsService.FilterFor the object types this filter is for.
FilterPosition Integer the integer of the filter set position.
FilterList List<c2g.AllocationsService.Filter> a list of filters.
DefaultFilterCriteria c2g.AllocationsService.DefaultFilterCriteria the picklist value of filtercriteria by default.

Methods

FilterStructure

global FilterStructure()

FilterStructure

global FilterStructure(String type, Integer filterPosition, List<c2g.AllocationsService.Filter> filterList)

Holds the structure of each filter set.

Input Parameters

Name Type Description
type String The filter structure types. For example, GeneralLedgerAccount, Dimension1, 2, 3 or 4.
filterPosition Integer The position of the filter set.
filterList List<c2g.AllocationsService.Filter> A list of filters.

Return Value

This constructor does not return a value.

FilterStructure

global FilterStructure(c2g.AllocationsService.FilterStructureType filterStructureType, Integer filterPosition, List<c2g.AllocationsService.Filter> filterList, c2g.AllocationsService.DefaultFilterCriteria defaultFilterCriteria)

Holds the structure of each filter set.

Input Parameters

Name Type Description
filterStructureType c2g.AllocationsService.FilterStructureType The filter structure types.
filterPosition Integer The position of the filter set.
filterList List<c2g.AllocationsService.Filter> A list of filters.
defaultFilterCriteria c2g.AllocationsService.DefaultFilterCriteria The value of FilterCriteria by default.

Return Value

This constructor does not return a value.

FilterStructure

global FilterStructure(c2g.AllocationsService.FilterStructureType filterStructureType, Integer filterPosition, List<c2g.AllocationsService.Filter> filterList, c2g.AllocationsService.DefaultFilterCriteria defaultFilterCriteria, c2g.AllocationsService.FilterFor filterFor)

Holds the structure of each filter set.

Input Parameters

Name Type Description
filterStructureType c2g.AllocationsService.FilterStructureType The filter structure types.
filterPosition Integer The position of the filter set.
filterList List<c2g.AllocationsService.Filter> A list of filters.
defaultFilterCriteria c2g.AllocationsService.DefaultFilterCriteria The value of FilterCriteria by default.
filterFor c2g.AllocationsService.FilterFor Item for which this filter is for.

Return Value

This constructor does not return a value.

c2g.AllocationsService.Filter

global class Filter

holds the values for each filterstructure depending on the filtercriteria.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.Filter filter1 = new c2g.AllocationsService.Filter();
filter1.FilterCriteria = c2g.AllocationsService.FilterCriteria.MultiselectValue;
filter1.Values = new List<Object> {'a1Cw00000002w45'};
c2g.AllocationsService.FilterStructure filterStr1 = new c2g.AllocationsService.FilterStructure();
filterStr1.FilterPosition = 1;
filterStr1.FilterStructureType = c2g.AllocationsService.FilterStructureType.Dimension1;
filterStr1.DefaultFilterCriteria = c2g.AllocationsService.DefaultFilterCriteria.MultiselectValue;
filterStr1.FilterList = new List<c2g.AllocationsService.Filter>{filter1};
c2g.AllocationsService.SplitStructure splitStr1 = new c2g.AllocationsService.SplitStructure();
splitStr1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr1.Dimension1Id = 'a1Cw00000002w45';
splitStr1.Percentage = 20;
c2g.AllocationsService.SplitStructure splitStr2 = new c2g.AllocationsService.SplitStructure();
splitStr2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr2.Dimension1Id = 'a1Cw00000002w45';
splitStr2.Percentage = 80;
c2g.AllocationsService.Template template = new c2g.AllocationsService.Template();
template.Name = 'Template1';
template.Description = 'Template Description';
template.FilterStructureList = new List<c2g.AllocationsService.FilterStructure> {filterStr1};
template.SplitStructureList = new List<c2g.AllocationsService.SplitStructure> {splitStr1, splitStr2};
List<id> templateId = c2g.AllocationsService.saveTemplates( new List<c2g.AllocationsService.Template> {template} );

Properties

Name Type Description
Values List<Object> a list of the objects with the id of the general ledger accounts or dimensions depending on filtercriteria.
FilterCriteria c2g.AllocationsService.FilterCriteria the filtercriteria values.

Methods

Filter

global Filter()

Filter

global Filter(c2g.AllocationsService.FilterCriteria filterCriteria, List<Object> values)

Holds the values for each FilterStructure depending on the FilterCriteria.

Input Parameters

Name Type Description
filterCriteria c2g.AllocationsService.FilterCriteria The filter criteria values
values List<Object> A list of objects with the ID of general ledger accounts or dimensions depending on FilterCriteria.

Return Value

This constructor does not return a value.

c2g.AllocationsService.SplitStructure

global class SplitStructure extends Entities

holds the same fields as the entities class as well as the split percentage.

This class extends c2g.AllocationsService.Entities

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.SplitStructure splitStr1 = new c2g.AllocationsService.SplitStructure();
splitStr1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr1.Dimension1Id = 'a1Cw00000002w45';
splitStr1.Dimension2Id = 'a1Dw0000001BIuj';
splitStr1.percentage= 20;
c2g.AllocationsService.SplitStructure splitStr2 = new c2g.AllocationsService.SplitStructure();
splitStr2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitStr2.Percentage = 80;
List<c2g.AllocationsService.SplitData> splitLines = c2g.AllocationsService.calculateSplitDataLines(new 
List<c2g.AllocationsService.SplitStructure>{splitStr1, splitStr2}, 33.33);

Properties

Name Type Description
Percentage Decimal value of the split percentage.
id Id id of the split line.

Methods

SplitStructure

global SplitStructure()

SplitStructure

global SplitStructure(Id generalLedgerAccountId, Id dim1Id, Id dim2Id, Id dim3Id, Id dim4Id, Decimal percentage)

Holds the same fields as the Entities class as well as the split percentage.

Input Parameters

Name Type Description
generalLedgerAccountId Id The ID of the general ledger account.
dim1Id Id The ID of Dimension 1.
dim2Id Id The ID of Dimension 2.
dim3Id Id The ID of Dimension 3.
dim4Id Id The ID of Dimension 4.
percentage Decimal The value of the split percentage.

Return Value

This constructor does not return a value.

c2g.AllocationsService.StatisticalBasisDistributionEntities

global abstract class StatisticalBasisDistributionEntities

holds general ledger account ids, total amount of sum of transaction line item home values and gladistribution value.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.StatisticalBasisDistributionEntities statisticalBasisDistributionEntities = new c2g.AllocationsService.RuleBasedStatisticalAllocation();
statisticalBasisDistributionEntities.GlaIds = new Set<Id>{'a1Lw00000020For','a1Lw00000030For'};
statisticalBasisDistributionEntities.Amount = 33.33;
statisticalBasisDistributionEntities.Distribution = c2g.AllocationsService.GLADistribution.Manual

Properties

Name Type Description
GlaIds Set<Id> list of general ledger account ids.
Amount Decimal value of the total amount of the sum of transaction line item home values.
Distribution c2g.AllocationsService.GLADistribution the gladistribution value.
RetrieveStructure c2g.AllocationsService.RetrieveStructure the retrievestructure value.

c2g.AllocationsService.StatisticalBasisAllocation

global class StatisticalBasisAllocation extends StatisticalBasisDistributionEntities

holds the fields from statisticalbasisdistributionentities class, basis name and other required information to create splitdata records.

This class extends c2g.AllocationsService.StatisticalBasisDistributionEntities

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.StatisticalFilter statisticalFilter = new c2g.AllocationsService.StatisticalFilter();
statisticalFilter.Id = 'b24240000356ALi';
statisticalFilter.FilterField = 'General Ledger Account';
statisticalFilter.Operator = 'Contains';
statisticalFilter.Value = 'Apex';

c2g.AllocationsService.StatisticalFilter statisticalFilter1 = new c2g.AllocationsService.StatisticalFilter();
statisticalFilter1.Id = 'b24240000365ALi';
statisticalFilter1.FilterField = 'Dimension 1';
statisticalFilter1.Operator = 'Equals';
statisticalFilter1.Value = 'Dim 1';

List<c2g.AllocationsService.StatisticalFilter> statisticalFilters = new List<c2g.AllocationsService.StatisticalFilter>{statisticalFilter, statisticalFilter1};

c2g.AllocationsService.StatisticalBasisAllocation statisticalBasisAllocation = new c2g.AllocationsService.StatisticalBasisAllocation();
statisticalBasisAllocation.BasisName = 'Statistical Basis Name';
statisticalBasisAllocation.DistributionFields = new List<String>{'General Ledger Account','Dimension 1','Dimension 2','Dimension 3','Dimension 4'};
statisticalBasisAllocation.DistributionFieldFilters = statisticalFilters;
statisticalBasisAllocation.GlaIds = new Set<Id>{'a1Lw00000020For','a1Lw00000030For'};
statisticalBasisAllocation.Amount = 33.33;
List<c2g.AllocationsService.SplitData> splitLines = c2g.AllocationsService.calculateSplitDataLinesForStatisticalAllocation(c2g.AllocationsService.StatisticalBasisAllocation statisticalBasisAllocation);

Properties

Name Type Description
BasisName String name of a statistical basis.
DistributionFields List<String> list of strings that represent the distribution fields.
DistributionFieldFilters List<c2g.AllocationsService.StatisticalFilter> list of filters applied on the distribution fields.

Methods

StatisticalBasisAllocation

global StatisticalBasisAllocation()

StatisticalBasisAllocation

global StatisticalBasisAllocation(String basisName, List<String> distributionFields, List<c2g.AllocationsService.StatisticalFilter> distributionFieldFilters, Set<Id> glaIds, Decimal amount, c2g.AllocationsService.GLADistribution distribution)

Holds the Basis Name and other required information to create SplitData records. This constructor is called when Distribution Type is 'Manually'

Input Parameters

Name Type Description
basisName String Name of a Statistical Basis.
distributionFields List<String> List of distribution fields.
distributionFieldFilters List<c2g.AllocationsService.StatisticalFilter> List of filters applied to Distribution Fields.
glaIds Set<Id> List of General Ledger Account Ids.
amount Decimal Value of the total amount of the sum of transaction line item home values.
distribution c2g.AllocationsService.GLADistribution Value of a GLADistribution.

StatisticalBasisAllocation

global StatisticalBasisAllocation(String basisName, List<String> distributionFields, List<c2g.AllocationsService.StatisticalFilter> distributionFieldFilters, c2g.AllocationsService.RetrieveStructure retrieveStructure, Decimal amount, c2g.AllocationsService.GLADistribution distribution)

Holds the Basis Name and other required information to create SplitData records. This constructor is called when Distribution Type is 'From Source'

Input Parameters

Name Type Description
basisName String Name of a Statistical Basis.
distributionFields List<String> List of distribution fields.
distributionFieldFilters List<c2g.AllocationsService.StatisticalFilter> List of filters applied to Distribution Fields.
retrieveStructure c2g.AllocationsService.RetrieveStructure Holds the reference of RetrieveStructure.
amount Decimal Value of the total amount of the sum of transaction line item home values.
distribution c2g.AllocationsService.GLADistribution Value of a GLADistribution.

StatisticalBasisAllocation

global StatisticalBasisAllocation(String basisName, List<String> distributionFields, List<c2g.AllocationsService.StatisticalFilter> distributionFieldFilters, Decimal amount, c2g.AllocationsService.GLADistribution distribution)

Holds the Basis Name and other required information to create SplitData records. This constructor is called when Distribution Type is 'From Basis'

Input Parameters

Name Type Description
basisName String Name of a Statistical Basis.
distributionFields List<String> List of distribution fields.
distributionFieldFilters List<c2g.AllocationsService.StatisticalFilter> List of filters applied to Distribution Fields.
amount Decimal Value of the total amount of the sum of transaction line item home values.
distribution c2g.AllocationsService.GLADistribution Value of a GLADistribution.

c2g.AllocationsService.StatisticalFilter

global class StatisticalFilter

holds information about the statistical filters.

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.StatisticalFilter statisticalFilter = new c2g.AllocationsService.StatisticalFilter();
statisticalFilter.Id = 'b24240000356ALi';
statisticalFilter.FilterField = 'General Ledger Account';
statisticalFilter.Operator = 'Contains';
statisticalFilter.Value = 'Apex';

Properties

Name Type Description
Id Id id of statistical basis filter.
FilterField String name of a filter.
Operator String operator name applied on filters.
Value String the value of a filter field.

Methods

StatisticalFilter

global StatisticalFilter()

StatisticalFilter

global StatisticalFilter(c2g.AllocationsService.DistributionFields filterField, c2g.AllocationsService.FilterOperator operator, String value)

Constructor to assign the values to the properties.

Input Parameters

Name Type Description
filterField c2g.AllocationsService.DistributionFields The DistributionFields value.
operator c2g.AllocationsService.FilterOperator The FilterOperator value.
value String Value of a filterField.

c2g.AllocationsService.RuleBasedStatisticalAllocation

global class RuleBasedStatisticalAllocation extends StatisticalBasisDistributionEntities

holds the fields from statisticalbasisdistributionentities class and statistical allocation rule id.

This class extends c2g.AllocationsService.StatisticalBasisDistributionEntities

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.RuleBasedStatisticalAllocation ruleBasedStatisticalAllocation = new c2g.AllocationsService.RuleBasedStatisticalAllocation();
ruleBasedStatisticalAllocation.RuleId = 'a04240000008ALi';
ruleBasedStatisticalAllocation.GlaIds = new Set<Id>{'a1Lw00000020For','a1Lw00000030For'};
ruleBasedStatisticalAllocation.Amount = 33.33;
List<c2g.AllocationsService.SplitData> splitLines = c2g.AllocationsService.calculateSplitDataLinesForStatisticalAllocation(c2g.AllocationsService.RuleBasedStatisticalAllocation ruleBasedStatisticalAllocation);

Properties

Name Type Description
RuleId Id id of a statistical allocation rule.

Methods

RuleBasedStatisticalAllocation

global RuleBasedStatisticalAllocation()

RuleBasedStatisticalAllocation

global RuleBasedStatisticalAllocation(Id ruleId, Set<Id> glaIds, Decimal amount, c2g.AllocationsService.GLADistribution distribution)

Holds the Basis Name and other required information to create SplitData records. This constructor is called when Distribution Type is 'Manual'

Input Parameters

Name Type Description
ruleId Id Statistical allocation rule Id.
glaIds Set<Id> List of General Ledger Account Ids.
amount Decimal Value of the total amount of the sum of transaction line item home values.
distribution c2g.AllocationsService.GLADistribution Value of a GLADistribution.

RuleBasedStatisticalAllocation

global RuleBasedStatisticalAllocation(Id ruleId, c2g.AllocationsService.RetrieveStructure retrieveStructure, Decimal amount, c2g.AllocationsService.GLADistribution distribution)

Holds the Basis Name and other required information to create SplitData records. This constructor is called when Distribution Type is 'From Source'

Input Parameters

Name Type Description
ruleId Id Statistical allocation rule Id.
retrieveStructure c2g.AllocationsService.RetrieveStructure Holds the reference of RetrieveStructure.
amount Decimal Value of the total amount of the sum of transaction line item home values.
distribution c2g.AllocationsService.GLADistribution Value of a GLADistribution.

RuleBasedStatisticalAllocation

global RuleBasedStatisticalAllocation(Id ruleId, Decimal amount, c2g.AllocationsService.GLADistribution distribution)

Holds the Basis Name and other required information to create SplitData records. This constructor is called when Distribution Type is 'From Basis'

Input Parameters

Name Type Description
ruleId Id Statistical allocation rule Id.
amount Decimal Value of the total amount of the sum of transaction line item home values.
distribution c2g.AllocationsService.GLADistribution Value of a GLADistribution.

c2g.AllocationsService.AllocationsStructure

global class AllocationsStructure

holds information of the retrievedatalist and the splitdatalist of the retrievestructure. AllocationsStructure class is referenced from both with sharing(AllocationsService) and without sharing(AllocationScheduleWorkerServiceImpl.PostWithoutSharing) contexts. c2g.AllocationsService is service class for Allocations. AllocationScheduleWorkerServiceImpl.PostWithoutSharing specifically uses without sharing in order to post schedules in different company other than user's current company. So the context behaviour of this class depends on the caller class. Therefore this class should remain in default context. CX_Ignore_Sharing

Sample Code

//Note: This sample code is for demonstration purposes only. It is not intended for
//use in a production environment, is not guaranteed against defects or errors, and
//is in no way optimized or streamlined.

c2g.AllocationsService.RetrieveData retrieveData1 = new c2g.AllocationsService.RetrieveData();
retrieveData1.GeneralLedgerAccountId = 'a1Lw00000020For';
retrieveData1.Dimension1Id = 'a1Cw00000002w45';
retrieveData1.Dimension2Id = 'a1Dw0000001BIuj';
retrieveData1.Dimension3Id = 'a1Ew000000Io7j6';
retrieveData1.Dimension4Id = 'a1Fw00000014wzA'; 
retrieveData1.TransactionLineItemsSumValue = 100;
c2g.AllocationsService.SplitData splitData1 = new c2g.AllocationsService.SplitData();
splitData1.GeneralLedgerAccountId = 'a1Lw00000020For';
splitData1.Dimension1Id = 'a1Cw00000002w45';
splitData1.Dimension2Id = 'a1Dw0000001BIuj';
splitData1.Amount = 25;
c2g.AllocationsService.SplitData splitData2 = new c2g.AllocationsService.SplitData();
splitData2.GeneralLedgerAccountId = 'a1Lw00000020For';
splitData2.Dimension3Id = 'a1Ew000000Io7j6';
splitData2.Dimension4Id = 'a1Fw00000014wzA';
splitData2.Amount = 75;
c2g.AllocationsService.AllocationsStructure allocationStr = new c2g.AllocationsService.AllocationsStructure();
allocationStr.RetrieveDataList = new List<c2g.AllocationsService.RetrieveData> {retrieveData1};
allocationStr.SplitDataList = new List<c2g.AllocationsService.SplitData>{splitData1, splitData2};
allocationStr.AllocationsDate = System.today();
allocationStr.PeriodId = 'a1uw0000001Kd6l';
List<Id> transactionIdList = c2g.AllocationsService.createAllocations(new List<c2g.AllocationsService.AllocationsStructure> {allocStructure});

Properties

Name Type Description
RetrieveDataList List<c2g.AllocationsService.RetrieveData> a list of retrievedata.
SplitDataList List<c2g.AllocationsService.SplitData> a list of splitdata that represents values where total amount is split.
AllocationsDate Date the date for all allocationsretrievedata.
PeriodId Id the period for all retrievedata.
Description String details of the allocation transaction description.
DestinationCompanyId Id selects the destination company in multi-company mode.
DestinationType c2g.AllocationsService.DestinationType the type of document created when createallocations is called. values: transactions (default) or journals.
AllocationType c2g.AllocationsService.AllocationType the type of allocation created when createallocations is called. the values are: fixed (default) or statistical.

Methods

AllocationsStructure

global AllocationsStructure()

the allocation record associated with this allocation structure.

AllocationsStructure

global AllocationsStructure(List<c2g.AllocationsService.RetrieveData> retrieveDataList, List<c2g.AllocationsService.SplitData> splitDataList, Date allocationsDate, Id periodId, String description)

Holds the RetrieveStructure and adds the SplitDataList.

Input Parameters

Name Type Description
retrieveDataList List<c2g.AllocationsService.RetrieveData> A list of RetrieveData.
splitDataList List<c2g.AllocationsService.SplitData> A list of SplitData that represents values where total amount is split.
allocationsDate Date The date for all RetrieveData.
periodId Id The period for all RetrieveData.
description String The description for the allocation structure.

Return Value

This constructor does not return a value.

© Copyright 2009–2022 FinancialForce.com, inc. All rights reserved. Various trademarks held by their respective owners.