Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

Auto fill Form field based on criteria

Posted on by 1,877

Hi Expert,

Our client has requirement to auto fill specific ledger account in SalesLine form as given below when SalesQty <0.

How can I do please help me.

Auto.jpg

*This post is locked for comments

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Auto fill Form field based on criteria

    I cannot help you further, now you need to debug and confirm that your code is in a right place and it gets executed then you need to confirm that Ax* class returns a value that is not 0.

  • faiz7049 Profile Picture
    faiz7049 1,877 on at
    RE: Auto fill Form field based on criteria

    Hi  ievgen Miroshnikov,

    Please help me.

  • AXTechie2120 Profile Picture
    AXTechie2120 560 on at
    RE: Auto fill Form field based on criteria

    Hi,

    In the modified field method of the  Quantity field write this piece of code,

    If(tablename.quantity<0)

    {

     tablename.Mainaccount  =4210225;

    }

  • faiz7049 Profile Picture
    faiz7049 1,877 on at
    RE: Auto fill Form field based on criteria

    Please help me.

  • faiz7049 Profile Picture
    faiz7049 1,877 on at
    RE: Auto fill Form field based on criteria

    Thanks ievgen Miroshnikov for helping me to get it done.

    I tried it but it's not working. It is same as before as given in below first screen shot.

    Auto2.jpg

    While I am trying to get like below screen shot which I entered manually.

    Auto2.jpg

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Auto fill Form field based on criteria

    No,  LedgerDimension  is int64 and '4210225' probably is your main account. So you can do something like:

    this.LedgerDimension = AxdDimensionUtil::getLedgerAccountId(['4210225', '4210225', 0]);

  • faiz7049 Profile Picture
    faiz7049 1,877 on at
    RE: Auto fill Form field based on criteria

    Hi ievgen,

    How to populate Ledger account ?

    case fieldNum(SalesLine, QtyOrdered):

               if(this.QtyOrdered <0)

                {

                  this.LedgerDimension = 4210225;    //(Ledger account)

                  }

                  break;

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Auto fill Form field based on criteria

    So it's a customization you need to do, you can add code to modifiedfield() method and check if it is >0 then populate ledger account.

  • Mea_ Profile Picture
    Mea_ 60,278 on at
    RE: Auto fill Form field based on criteria

    So it's a customization you need to do, you can add code to modifiedfield() method and check if it is >0 then populate ledger account.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans