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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Answered

Set Default Offset Account Dimension

(0) ShareShare
ReportReport
Posted on by 563

Dear Experts,

I'm beginner developing AX 2012

I create Ledger Journal by X++ code and successfully create new Journal with Line, but can't be posted because default offset dimension is still empty

default-offset-account.PNG

How to set Default Offset Account Dimension through X++?

Thanks in advance

regards,

Bintang

*This post is locked for comments

I have the same question (0)
  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    This value is typically initialized from account type such as in case of customer it comes from customer default dimension and so on for fix asset or for vendor etc.

    Given that you don’t want to take it from entity (customer, vendor etc.) you can get it  from AxdDimensionUtil::getDimensionAttributeValueSetId

  • Bintang Profile Picture
    563 on at

    Dear Mr Sohaib Cheema,

    I mean what is code I can use to set Default Offset Account Dimension?

    AxLedgerJournalTrans journalTrans;
    
    offSetAcctPattern = ["40100-TOPUP","40100", 1, "TransactionType","TOPUP"]; 
    journalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId(offSetAcctPattern)); 


    That code to set Offset Account Dimension, what code for set Default Offset Account Dimension?

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    you can pass a container which will contain collection of your dimensions whichever you want to pass. in your case as I can see from screenshot you have got only a single dimension so you can pass that as single container element while calling the methos of AxdDimensionUtil

    You can find many examples on googling, related to AxdDimensionUtil::getDimensionAttributeValueSetId

    e.g. you can find one here dynamics-resources.com/financial-dimensions-using-x

    Do let us know, if you find it difficult to search.

  • Bintang Profile Picture
    563 on at

    Sorry I don't get it

    Let me try to tell the detail of my step

    The first step I read the Excel File and save it to Temporary Table

    Then, I process it to LedgerJournalTable and LedgerJournalTrans and success

    The Default Offset Account Dimension is still empty, I want to set the Default Offset Account Dimension dynamically based on my data from Excel File

    defDim = [1,"TransactionType", "TOPUP"];
        axLedgerJournalTable.parmDefaultDimension(AxdDimensionUtil::getDimensionAttributeValueSetId(defDim));


    I found this code, but only for set Default Financial Dimension Account

    how about Default Financial Dimension Offset Account? Or I can't set Default Financial Dimension Offset Account by code?

    correct me if I wrong

    Thank you

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    you can set value of default dimension or offset default dimension by code.

    as I said you can use AxdDimensionUtil::getDimensionAttributeValueSetId to get recid of combination created.

    Have you seen at URL given to you in my previous reply?

    AxdDimensionUtil::getDimensionAttributeValueSetId will take a parameter from you of type container. in your container, you can pass dimensions.

  • Bintang Profile Picture
    563 on at

    if I don't missed something , that article told me how to get RecId or check availability of dimension and Create Ledger Dimension, correct me if I wrong

    Just explain me the code if there is no objection, code like this :

    axLedgerJournalTrans.parmJournalNum(axLedgerJournalTable.ledgerJournalTable().JournalNum); //To set JournalNum
    
    axLedgerJournalTrans.parmTransDate(systemDateGet()); //To set Transaction Date
    
    axLedgerJournalTrans.parmDefaultDimension(AxdDimensionUtil::getDimensionAttributeValueSetId(dimPattern1)); //To set Default Dimension Account
    
    axLedgerJournalTrans.parmOffsetAccountType(LedgerJournalACType:: Ledger ); //To Set Offset Account Type
    
    axLedgerJournalTrans.parmOffsetLedgerDimension(AxdDimensionUtil::getLedgerAccountId( offSetPattern)); //To set Offset Ledger Dimension
    
    // Is there any parmDefaultOffsetDimension or other code?

    Sorry If I slow understanding, I'm still beginner and trying to learn and understanding dynamic ax development

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    Here you go with sample code. get recid  pass it to parmDefaultDimension or pass it to ParmOffsetDefaultDimension

        container   varContainer;
        Counter     varCounter=0;
        RecId       retValueOfDefDimension;
        ;
        
        varContainer = [0];
        
        //assigning one dimension
        varContainer += ["Department","025"];
        varCounter++;//increase on assignmnet of each dimension
        
        //assigning 2nd dimension
        varContainer += ["CostCenter","010"];
        varCounter++;//increase on assignmnet of each dimension
        
        //so on.. you can pass any number of dimensions
        
        //prepare container
        varContainer = conPoke(varContainer,1,varCounter);
        
        //pass continer and get back value generated
        retValueOfDefDimension = AxdDimensionUtil::getDimensionAttributeValueSetId(varContainer);
        
        //display just for demo puprose. in real practice simply assign it to table field(s)
        if(retValueOfDefDimension)
            info(strFmt('You can verify record with RecId %1 in Table DimensionAttributeValueSetItem by filtering on field DimensionAttributeValueSet.',retValueOfDefDimension));    
        


  • Bintang Profile Picture
    563 on at

    sadly no parmOffsetDefaultDimension on AxLedgerJournalTrans class, that's the reason why I ask a question to the forum :(

    I understand your code is how to get RecId, but I don't know how to set it

    I don't find function to set Default Financial Dimension Offset Account

    If you don't mind , I follow this article to create a journal

    https://community.dynamics.com/ax/b/axaptavsme/archive/2013/09/11/x-code-to-create-amp-post-general-journal

    but on that article didn't tell me how to set Default Financial Dimension Offset Account

  • Sohaib Cheema Profile Picture
    49,668 Super User 2026 Season 1 on at

    are you using AxLedgerJournalTrans class?

  • Bintang Profile Picture
    563 on at

    Yes that's right

    If you don't mind , I follow this article to create a journal

    community.dynamics.com/.../x-code-to-create-amp-post-general-journal

    but on that article didn't tell me how to set Default Financial Dimension Offset Account

    do you have any idea?

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sanhthosh.Kumar.K Profile Picture

Sanhthosh.Kumar.K 2

#2
Raed Salah Bzour Profile Picture

Raed Salah Bzour 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans