How to hide record type selection dialog from inherited table form in Dynamics AX7 (Dynamics 365 for Operations) (Select a record type to create)

Hi ,

How to hide record type selection dialog from inherited table form in Dynamics AX (Dynamics 365 for Operations) - (Select a record type to create)

I have added EcoResProudct in Form  DataSource for ItemName Display. like below



When i run Form below Dialog opens first and does not display any record in form. (Select a record type to create)


Problem is the Microsoft Dynamics AX client framework dynamically creates a type picker dialog and populates the list that prompts the user to select the type of the record to be created, as shown in Figure above.The list includes all the concrete table types that derive from the table serving as the data source for the form. A very critical scenario to which all of us may deal with, when ever we are working with Table Inheritance feature of Dynamics AX.

Override the Form's CreateRecord method like below and Just invoke CreateTypes method of EcoResProduct DataSource.


[Form]
public class PriceDiscTableListPage extends FormRun
{
    /// <summary>
    ///
    /// </summary>
    /// <param name = "_formDataSourceName"></param>
    /// <param name = "_append"></param>
    public void createRecord(str _formDataSourceName, boolean _append = false)
    {
        Map typesToCreate  = new Map(Types::String, Types::String);
    
        // To create record in Parent table (EcoResProduct)
        typesToCreate.insert(_formDataSourceName,tableId2name(tableNum(EcoResProduct)));
        // To create record in Derived table (EcoResDistinctProduct)
        typesToCreate.insert(_formDataSourceName,tableId2name(tableNum(EcoResDistinctProduct)));
        // To create record in Derived table (EcoResProductMaster)
        typesToCreate.insert(_formDataSourceName,tableId2name(tableNum(EcoResProductMaster)));
    
        EcoResProduct_ds.createTypes(typesToCreate);

    }

    [DataSource]
    class EcoResProduct
    {
        /// <summary>
        ///
        /// </summary>
        /// <param name = "_concreteTypesToCreate"></param>
        /// <param name = "_append"></param>
        /// <param name = "_implicitCreate"></param>
        /// <param name = "_explicitCreate"></param>
        public void createTypes(Map _concreteTypesToCreate, boolean _append = false, boolean _implicitCreate = false, boolean _explicitCreate = false)
        {
                    super(_concreteTypesToCreate, _append, _implicitCreate, _explicitCreate);
        }

    }

}

Form works fine once after adding above code.

Reference
https://community.dynamics.com/ax/b/yasirsmicrosoftdynamicsaxworkshop/archive/2012/07/31/how-to-hide-record-type-selection-dialog-from-inherited-table-form-in-dynamics-ax

http://yasirnedian.blogspot.ae/2012/07/how-to-hide-record-type-selection.html?view=sidebar





Comments