Interview Questions

Friday, April 25, 2014

Change Grid Color at certain condition for a form in AX 2012

Just add a displayOption method on your form datasource, it changes line color if some conditions are met.
public void displayOption(Common _record, FormRowDisplayOption _options)
{
    YourCurrentTable  YourCurrentTable = _record;
    YourOtherTable    YourOtherTable;
    ;
    select firstonly  YourOtherTable where YourOtherTable.yourOtherField ==  YourCurrentTable.yourCurrentField;

    if(YourOtherTable.yourOtherField)
        {
             _options.backColor(WinApi::RGB2int(50,255,50));
        }

    super(_record, _options);
}

No comments:

Post a Comment