SBX - Search With Button

SBX - Forum Post Title

Auto fill Form field based on criteria

Microsoft Dynamics AX Forum

faiz7049 asked a question on 8 Nov 2018 1:05 AM
My Badges

Question Status

Unanswered

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.

Reply
ievgen Miroshnikov responded on 8 Nov 2018 1:22 AM

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.

Reply
ievgen Miroshnikov responded on 8 Nov 2018 1:22 AM

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.

Reply
faiz7049 responded on 8 Nov 2018 2:04 AM
My Badges

Hi ievgen,

How to populate Ledger account ?

case fieldNum(SalesLine, QtyOrdered):

           if(this.QtyOrdered <0)

            {

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

              }

              break;

Reply
ievgen Miroshnikov responded on 8 Nov 2018 2:49 AM

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

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

Reply
faiz7049 responded on 8 Nov 2018 3:22 AM
My Badges

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.

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

Reply
faiz7049 responded on 8 Nov 2018 4:46 AM
My Badges

Please help me.

Reply
AXTechie2120 responded on 8 Nov 2018 4:57 AM
My Badges

Hi,

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

If(tablename.quantity<0)

{

 tablename.Mainaccount  =4210225;

}

Reply
faiz7049 responded on 8 Nov 2018 5:21 AM
My Badges

Hi  ievgen Miroshnikov,

Please help me.

Reply
ievgen Miroshnikov responded on 8 Nov 2018 12:17 PM

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.

Reply

SBX - Two Col Forum

SBX - Migrated JS