Showing posts with label Trial Balance. Show all posts
Showing posts with label Trial Balance. Show all posts

Wednesday, October 11, 2017

Rebuild and Update balances through X++

Hi Guys,

If you are posting journals through X++ and facing issues in trial balance update you can use below code to rebuild and update balances.


public void run()
{
    DimensionFocusProcessBalance    dimFocusProcessBal = new DimensionFocusProcessBalance();
    DimensionFocusUpdateBalance     dimFocusUpdateBal = new DimensionFocusUpdateBalance();
    DimensionHierarchy focusDimensionHierarchy;

    while Select focusDimensionHierarchy
        where focusDimensionHierarchy.FocusState == DimensionFocusBalanceInitializationState::Initialized
    {
        dimFocusProcessBal = DimensionFocusProcessBalance::construct(NoYes::No, focusDimensionHierarchy);
        dimFocusProcessBal.run();
        dimFocusUpdateBal = DimensionFocusUpdateBalance::construct(focusDimensionHierarchy);
        dimFocusUpdateBal.run();
    }

    info("Balances Updated !");
}