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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Joining EcoResProduct in form - Popup on creating a new record

(0) ShareShare
ReportReport
Posted on by 133
I have created a form for my new table. In this form I have added the EcoResProduct table as data source via an inner join, as I want to show the product search name in my grid. The Data source has set Allow Create, Allow Delete and Allow Edit all to /No/. I have overridden the validateWrite and write functions in the datasource, to make sure no entry can be inserted in the EcoResProduct table from my new form.
 
However, when I try to create a new entry for my own table in the form, I still get a popup where I have to select what type of Product I want to create: 
 
If I just select one of those, I can continue, and my form works normally. I can save the entry in my new table without problems. However, I still want to get rid of this annoying popup.
 
So far, I have understood that this has to do with the fact that EcoResProduct is an abstract table, and that I should be able to get rid of this popup by setting the createTypes in the createRecord function. I have found this link as reference: How to hide record type selection dialog from inherited table form in Dynamics AX
 
However, for some reason this doesn't seem to work for me.
 
So the datasources in my form are as follows:
- MyTable
- InventTable (inner join with MyTable on ItemId)
- EcoResProduct (Inner join with InventTable)
 
Maybe the problem is that in the example, the abstract table is the first datasource in the form, while in my example it is the third.
 
I have overridden the createRecord function in the form as follows:
 
public void createRecord(str _formDataSourceName, boolean _append = false)    {    Map typesToCreate  = new Map(Types::String, Types::String);                typesToCreate.insert(formDataSourceStr(MyTable, EcoResProduct),tableId2name(tableNum(EcoResProductMaster)));    MyTable_ds.createTypes(typesToCreate);    EcoResProduct_ds.createTypes(typesToCreate);    super(_formDataSourceName, _append);}
I have tried setting the createTypes on the primary datasource, as well as the EcoResProduct datasource, but it seems to make no difference.
 
Who can guide me in the right way to solve this?
 
I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at
    Hi FV@E,
     
    When you create a new record in your new table, there is initially no EcoRecProduct record. This table needs to know the type. Have you tried another join option and not inner join? 
    If you need to display the search name only, you can also consider a diplay method on your new table instead of the various data sources and joins.
  • FV@E Profile Picture
    133 on at
    Hi Andre,
     
    Thank you for the suggestion. I have tried outer join as well, but that makes no difference.
     
    Your suggestion of a display method is not a bad one. If no other solutions work, I'll try that. However, I expect that for performance a table join will be much faster than a display method on each record in the grid.
  • Suggested answer
    FV@E Profile Picture
    133 on at
    After some experimenting, I managed to solve the issue myself.
     
    Apparently I missed one important step from the link that I already found: to skip the super() call.
     
    So for future reference, if anyone has the same question, this was my solution:
     
    public void createRecord(str _formDataSourceName, boolean _append = false)
        {
            // Since EcoResProduct is an abstract table, we need to specify here what instance we want to set
            // Otherwise we will get a popup to specify which one we want
            Map tableNamesMap;
    
            tableNamesMap = new Map(Types::String, Types::String);
            tableNamesMap.insert(formDataSourceStr(MyTable, EcoResProduct), tableStr(EcoResProductMaster));
            MyTable_ds.createTypes(tableNamesMap, _append);
    
            // Important: skip the super() call
        }
     
  • André Arnaud de Calavon Profile Picture
    301,075 Super User 2025 Season 2 on at
    Hi FV@E,
     
    Thanks for providing your solution. This can be helpful for other people with a similar problem.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans