Aman Jamwal
Aman Jamwal

Reputation: 11

How is DataAreaId field related to FiscalCalendarPeriod table in Dynamics AX 2012?

I tried many approaches but none of them seems to get me a concrete relation between FiscalCalenderPeriod table and the DataAreaId attribute in dynamics AX 2012.

DataAreaID was a part of LedgerPeriod in Dymanics AX 2009, but now this table has been depriciated, so the data has been normalised.

How can I map FiscalCalenderPeriod with a Company Data i.e. dataareaid?

Upvotes: 1

Views: 3220

Answers (1)

Jay Hofacker
Jay Hofacker

Reputation: 3469

A DataAreaId identifies a Legal entity (a record in the CompanyInfo table). Each Legal entity has a Ledger (a record in the Ledger table where the PrimaryForLegalEntity field is the RecId of the CompanyInfo record). A Ledger is tied to a FiscalCalendar record by the FiscalCalendar field. FiscalCalendarPeriod records also belong to a particular FiscalCalendar based on the FiscalCalendar field.

There is a helper class FiscalCalendars that has many methods for dealing with Fiscal calendars. For example, here's one way to get the end date of the current period for the company 'CEU':

RecId fiscalCalendarRecId=Ledger::fiscalCalendar(CompanyInfo::find('CEU').RecId);
date currentDate=SystemDateGet();
date endDate=FiscalCalendars::findPeriodEndDateByDate(fiscalCalendarRecId,currentDate);
info(date2StrUsr(endDate));

Upvotes: 3

Related Questions