Form color

I have a form with Int field, and recod values are 1 …10. now i want color a form grid rows based on condition i.e,

values with >= 4 ,records only have the color (or) vaue == 4 only one record have the color .

and also similar tasks.

You have to use displayOption method on the datasource. You should start with the AX form called tutorial_Form_DisplayOption, it’s here exactly for this purpose.

Hello,

The FormDataSource.displayOption Method sets the text color and the background color for a record in the data source.

public void displayOption(Common record, FormRowDisplayOption options)

Parameter Description

record The record to be displayed by using the specified options.

options The FormRowDisplayOption object that encapsulates the desired record display properties.

This method is executed once for each record before the record is displayed on a form. The displayOption method can be overridden on a form data source. Right-click the Methods node under the data source, and then select Override Method > displayOption.

Note: The statements in the displayOption method are not necessarily executed sequentially. Do not base your code on the first lines of code being executed before the last lines.

Here is an example of overriding the displayOption method in the InventTable datasource of the InventTable form.

public void displayOption(Common _record, FormRowDisplayOption _options)

{

InventTable inventTableRecord;

;

inventTableRecord = _record;

if (inventTableRecord.ItemGroupId == “Parts”)

{

_options.textColor(505);

_options.backColor(606);

}

super(_record, _options);

}

You can put the conditions in your form as per your requirement.