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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Creating a Form in AX 2012

(0) ShareShare
ReportReport
Posted on by 495

Hello Everyone,

I need some help to create a form using fields from InventTable and InventTableModule. The two fields the form will use are ItemID and SalesPrice. 

This is the job to get the sales price base on the itemid passed.

static void AXListPrices(Args _args)
{
InventTable it;
InventTableModule itm;
;
while select it where it.ItemId=="100001"
join itm where it.itemid == itm.ItemId
&& itm.ModuleType == ModuleInventPurchSales::Sales
{
       info(strFmt("%1", itm.Price));
}
}

All I need to go is the following......

Create a form that allow the user to choose a item number and then the corresponding sale price will be displayed. 

Please my friends that all i want o do any help, suggestions or example would be greatly appreciated.

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Rustem Galiamov Profile Picture
    8,072 on at

    Hi Lionel07!

    You want to create a form with only two fields?

    So, create a field with items lookup and a field (set allowEdit to NO) which will display sales price. Then override modified() method on first field and fill sales price value.

  • Lifeisbelieveful Profile Picture
    363 on at

    You can use the Item Id value from the form as follow, then you can use the value in where condition to select sales price.

    _itemId =ItemId.valueStr(); // ItemId is stringEdit which you are going to make for Item Id and should change the property "AutoDeclaration" to Yes.

  • Lionel07 Profile Picture
    495 on at

    thanks for responding Rustem,

    I am trying my best to follow your recommendation because am not clear as to what i must do.

    this is what i have done:

    1. Created a new table with two fields image newtable

    newtableFORM.png

    with this table i used the EDT on ItemID to get the lookup from InventTable (see relation)

    2. I created a form and use table (newtable) as its datasource see image newtableform

    newtableFORM.png

    3. Under the ItemID field I override the modified method by adding this code:

    using the following code:

    public void modified()
    {
    InventTable it;
    InventTableModule itm;
    ItemPrice itemp;
    ;

    if(itemp.ItemIDCost)

    {

    while select itemp where itemp.ItemIDCost==it.ItemId
    join itm where it.itemid == itm.ItemId
    && itm.ModuleType == ModuleInventPurchSales::Sales
    {
    itemp.ItemPriceShow = strFmt("",itm.Price);
    }

    }
    }

     After doing this nothing happens. The Price is not displaying in the in the other field. Can you please help me? i have a deadline and need to complete this. Please your help on it.  

    my form

    1385.FORM.png

  • Lionel07 Profile Picture
    495 on at

    I am trying my best to follow the recommendations because am not clear as to what i must do.

    this is what i have done:

    1. Created a new table with two fields image newtable

    newtableFORM.png

    with this table i used the EDT on ItemID to get the lookup from InventTable (see relation)

    2. I created a form and use table (newtable) as its datasource see image newtableform

    newtableFORM.png

    3. Under the ItemID field I override the modified method by adding this code:

    using the following code:

    public void modified()
    {
    InventTable it;
    InventTableModule itm;
    ItemPrice itemp;
    ;

    if(itemp.ItemIDCost)

    {

    while select itemp where itemp.ItemIDCost==it.ItemId
    join itm where it.itemid == itm.ItemId
    && itm.ModuleType == ModuleInventPurchSales::Sales
    {
    itemp.ItemPriceShow = strFmt("",itm.Price);
    }

    }
    }

     After doing this nothing happens. The Price is not displaying in the in the other field. Can you please help me? i have a deadline and need to complete this. Please your help on it.  

    my form

    1385.FORM.png

    please help

  • Verified answer
    Rustem Galiamov Profile Picture
    8,072 on at

    You don't need to create a table.

    Just create a form with two fields:

    Screenshot-2018_2D00_12_2D00_30-at-19.41.12.png

    1. Item number - create string field and set EDT ItemId

    Screenshot-2018_2D00_12_2D00_30-at-19.40.46.png

    2. Item sales price - create real field and set EDT SalesPrice, AutoDeclaration = YES, AllowEdit = No

    Screenshot-2018_2D00_12_2D00_30-at-19.41.01.png 

    3. On Item number field override modified() method and write this code:

    Screenshot-2018_2D00_12_2D00_30-at-19.41.12.png

    public boolean modified()
    {
        boolean           ret;
    
        ret = super();
    
        ItemSalesPrice.realValue(InventTableModule::find(this.valueStr(), ModuleInventPurchSales::Sales).Price);
    
        return ret;
    }


  • Lionel07 Profile Picture
    495 on at

    Thanks a million Rustem, I have been working on this over a week now. Thanks much again am good to go now. Really appreciate your help.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Andrew Jones a1x Profile Picture

Andrew Jones a1x 2

#3
GL-01081504-0 Profile Picture

GL-01081504-0 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans