Skip links

Coloring records


Notice: Trying to access array offset on value of type bool in /var/www/vhosts/dmrbt.com/httpdocs/wp-content/themes/boo/rella/extensions/aq_resizer/aq_resizer.php on line 117

Notice: Trying to access array offset on value of type bool in /var/www/vhosts/dmrbt.com/httpdocs/wp-content/themes/boo/rella/extensions/aq_resizer/aq_resizer.php on line 118

Notice: Trying to access array offset on value of type bool in /var/www/vhosts/dmrbt.com/httpdocs/wp-content/themes/boo/rella/extensions/aq_resizer/aq_resizer.php on line 117

Notice: Trying to access array offset on value of type bool in /var/www/vhosts/dmrbt.com/httpdocs/wp-content/themes/boo/rella/extensions/aq_resizer/aq_resizer.php on line 118
Coloring records

The possibility to color individual records is one Dynamics AX feature that can improve user experience. Normally, people like to see a reasonable number of colors in the interface they use. This makes their daily tasks not so boring. One of the common requests is to emphasize the importance of disabled records, for example, terminated employees or stopped customers by displaying their records in a different color, normally red. An opposite example could be to show processed records like posted journals or invoices sales orders, let’s say in green. In this recipe, we will color locked-in-journal accounts in the Chart of accounts form.
How to do it…

1. In AOT, open the LedgerTableListPage form and override the displayOption()
method in its LedgerTable data source with the following code:
public void displayOption(
Common _record,
FormRowDisplayOption _options)
{;
if (_record.(fieldnum(LedgerTable,BlockedInJournal)))
{
_options.backColor(WinAPI::RGB2int(255,100,100));
}
super(_record, _options);
}
2. To test the coloring, open General ledger | Places | Chart of Accounts and notice
how locked-in-journal accounts are displayed now in a different color:
How it works…
The method displayOption() on any form’s data source can be used to change some
of the visual options. Every time, before displaying the record, this method is called
by the system with two arguments; the first is the current record and the second is a
FormRowDisplayOption object, whose properties can be used to change record visual
settings. In this example, we check if current ledger account record is locked in journal and if
yes, we change the background property to light red by calling backColor().
Source
Microsoft Dynamics AX 2009 Development Cookbook Dec 2009

Opinions

Join the Discussion