26 July 2019

Display inventory dimensions dynamically in D365 / Add display inventory dimensions in form

Display inventory dimensions dynamically in D365

Please click here for link

and use the below code to 

InventDimCtrl_Frm_EditDimensions    inventDimFormSetup;

 /// <summary>
    /// Inventory dimension group method.
    /// </summary>
    /// <returns>
    /// A <c>InventDimCtrl_Frm_EditDimensions</c> object.
    /// </returns>
    InventDimCtrl_Frm_EditDimensions inventDimSetupObject()
    {
        return inventDimFormSetup;
    }

 /// <summary>
    /// Initializes the range and inventory dimensions to be display while opening the form
    /// </summary>
    public void init()
    {
        super();
        // Add a filter to the query. Specify the field to use in the filter.
       
        //This method will be used to show default fields at the form setup
        element.updateDesign(InventDimFormDesignUpdate::Init);
    }
/// <summary>
    /// Update design mode as per inventory dimension
    /// </summary>
    /// <param name="_mode">
    /// Inventory dimension design mode.
    /// </param>
    void updateDesign(InventDimFormDesignUpdate _mode)
    {
        switch (_mode)
        {
            // Form Init
            case InventDimFormDesignUpdate::Init    :
                if (!inventDimFormSetup)
                {
                    inventDimFormSetup  = InventDimCtrl_Frm_EditDimensions::newFromForm(element);
                    inventDimFormSetup.parmSkipOnHandLookUp( true);
                }

            // Datasource Active
            case InventDimFormDesignUpdate::Active  :
                inventDimFormSetup.formActiveSetup(InventDimGroupSetup::newItemId(DataSourceTable.ItemId)); //InventDimDisplay is the datasource name.
                inventDimFormSetup.formSetControls( true);
                break;

            // Datasource Field change
            case InventDimFormDesignUpdate::FieldChange :
                inventDimFormSetup.formActiveSetup(InventDimGroupSetup::newItemId(DataSourceTable.ItemId)); //InventDimDisplay is the datasource name.
                InventDim.clearNotSelectedDim(inventDimFormSetup.parmDimParmEnabled()); // InventDim is referring to datasource name
                inventDimFormSetup.formSetControls( true);
                break;

            default :
                throw error(strFmt ("@SYS54195", funcName()));

        }
    }
Add the below code in the DS active method.
int  active()
        {
            int ret;

            ret = super();

            element.updateDesign(InventDimFormDesignUpdate::Active);

            return ret;

        }


No comments:

Post a Comment

Give me the commetns and solutions

Ledger Voucher creation Framework and x++ code to create ledger voucher

 Please click her for MS reference file Below is the out of the box example reference and code. SalesInvoiceJournalPostSubBill_Extension->...