AX – D365FO – Change Background or text color of a Form grid row

You can use FormDataSource.displayOption method

This method is executed one time for each record before the record is displayed in a form.

The displayOption method can be overridden on a form data source. Right-click the Methods node under the data source, point to Override Method, and then click displayOption.

This is an example

public void displayOption(Common _record, FormRowDisplayOption _options)
SalesTable prodtablelocal;
prodtablelocal = _record;
   Case SalesStatus::Delivered:
   _options.backColor(65535); //Light Yellow
   Case SalesStatus::Invoiced:
   _options.backColor(8421631); //Light Red
   Case SalesStatus::Backorder:
   _options.backColor(65408); //Light Green

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s