Tuesday, 10 February 2015

Coloring the grid in the form grid in AX 2012 based on the condition

Say We have a requirement in the form that all the boys should be marked as green color and rest every thing should be  plain(no color)

First we create a table where we put a field which is sex and this sex is a base enum will contain 3 values like none,male and female.


then create a form with the respective datasource  and design a grid and put all the fields over there


then write the code  by overwriting the datasource
public void displayOption(Common _record, FormRowDisplayOption _options
{

    Aaaaa   Aaaaaloc = _record;

   if(Aaaaaloc.sex == ABC::male)
    {
        _options.backColor(WinApi::RGB2int(50,255,50)); //Green
    }


    super(_record, _options);
}

see the out put as :



No comments:

Post a Comment

intercompany PO multiple product receipt by x++

public void processStampICPO(PackingSlipId _deliveryNote,                             Transdate _deliverydate,                             ...