Sunday, May 24, 2020

Making all fields mandatory/necessary in dialog form in Ax 2012

Write this code in the validate form
(accordingly)


public boolean validate(Object calledFrom = null)
{
    boolean ret;

    ret = super(calledFrom);

    if(!fromDate)
    {
        ret =   checkFailed("From Date must be entered");
    }
    else if(!toDate)
    {
        ret =   checkFailed("To Date must be entered");
    }
    else if(!fromDataAreaId)
    {
        ret =   checkFailed("From company must be entered");
    }
    else if(!toDataAreaId)
    {
        ret =   checkFailed("To company must be entered");
    }
    else if(!generalType)
    {
        ret =   checkFailed("General Type must be entered");
    }
    else if(!mainAccounts)
    {
        ret =   checkFailed("Accounts must be entered");
    }
    else if(!division)
    {
        ret =   checkFailed("Division must be entered");
    }

    return ret;
}