web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Query Fiscal Year settings

(0) ShareShare
ReportReport
Posted on by

Hello.  Is it possible to query the Fiscal Year Settings?  If a user enters 1/1/2015 as the Start Date, then I want to query CRM and find that date.

Thanks for reading.

fiscal.gif

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Community Member Profile Picture
    on at
    RE: Query Fiscal Year settings

    Hi Rob,

    You can see the setting of this Fiscal Year asking a DB of your organization and review the table to compare the data:

    You can use the SQL table "Award_Date"

    Best Regards,

  • RH-30102145-0 Profile Picture
    on at
    RE: Query Fiscal Year settings

    Thank you for the SQL location, but I need to access it via the API.

    Does anyone know the correct Microsoft.XRM.SDK class?

  • Verified answer
    Aileen Gusni Profile Picture
    44,524 on at
    RE: Query Fiscal Year settings

    Hi Rob,

    You can access this through SDK by using standard Retrieving, that is in the Organization Entity.

    There is no dedicated Class Message for this Rob

    Overall, you just need to query Organization Entity and also Fiscal Year setting is stored in the FiscalCalendarStart field or "fiscalcalendarstart" if you use Early Bound.

    Here is the code you can use

    //Using LINQ

    private void RetrieveOrganizationFiscalYear()

    {

    _service = new XrmContext();

    XrmContext xrmContext = new XrmContext();

    var OrganizationSettings = from os in xrmContext.OrganizationSet

    select new Organization

    {

    FiscalCalendarStart = os.FiscalCalendarStart,

    };

    DateTime dtStartFiscalYear = OrganizationSettings.First().FiscalCalendarStart.Value;

    }

    //Using Late Bound

    private void RetrieveOrganizationFiscalYearLateBound(IOrganizationService _service)

    {

    //Retrieve organization

    Entity enOrganization = new Entity("organization");

    EntityCollection ecOrganizations = new EntityCollection();

    DateTime dtStartFiscal = new DateTime();

    QueryExpression qx = new QueryExpression();

    qx.EntityName = "organization";

    qx.ColumnSet.AllColumns = true;

    ecOrganizations = _service.RetrieveMultiple(qx);

    if (ecOrganizations.Entities.Count > 0)

    {

    enOrganization = ecOrganizations.Entities[0];

    dtStartFiscal = enOrganization.GetAttributeValue<DateTime>("fiscalcalendarstart");

    }

    }

    I hope this can help you!

    Thanks.

  • RH-30102145-0 Profile Picture
    on at
    RE: Query Fiscal Year settings

    Perfect!  thank you Aileen.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#2
ED-30091530-0 Profile Picture

ED-30091530-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans