Skip to main content

Event handling of dialog fields in D365. #ax #d365 #dynamics #x++

Today I'm going to show that how you can do event handling of dialog fields in D365. I'm trying to enable/disable a field based on a condition.


    public Object dialog()
    {
        DialogRunbase dialog = next dialog();
        DialogGroup dateIntervalGrp;
        dateIntervalGrp = dialog.addGroup("DateInterval");
        dlgDateInterval = dialog.addFieldValue(extendedTypeStr(DateCode), dateInterval,           "DateInterval");
        dlgDateInterval.registerOverrideMethod(methodStr(FormStringControl, modified), methodStr(SAPPayroll, dlgDateInterval_modified), this);


        return dialog;
    }


    private boolean dlgDateInterval_modified(FormStringControl _dlgDateInterval)
    {
        //If we have date interval value then start and end date will be disable.
        if (dlgDateInterval.value() != '')
        {
            dlgStartDate.enabled(false);
            dlgStartDate.value(false);
            dlgEndDate.enabled(false);
            dlgEndDate.value(false);
        }
        else
        {
            dlgStartDate.enabled(true);
            dlgEndDate.enabled(true);
        }
        return true;
    }

Comments

*This post is locked for comments