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;
Switch(prodtablelocal.SalesStatus)
{
   Case SalesStatus::Delivered:
   _options.backColor(65535); //Light Yellow
    _options.affectedElementsByControl(Salestable_SalesId.id());
   Break;
   Case SalesStatus::Invoiced:
   _options.backColor(8421631); //Light Red
   _options.affectedElementsByControl(Salestable_SalesId.id());
   Break;
   Case SalesStatus::Backorder:
   _options.backColor(65408); //Light Green
   _options.affectedElementsByControl(Salestable_SalesId.id());
   _options.textColor(12582912);
   Break;
}
}

Rispondi

Inserisci i tuoi dati qui sotto o clicca su un'icona per effettuare l'accesso:

Logo di WordPress.com

Stai commentando usando il tuo account WordPress.com. Chiudi sessione /  Modifica )

Google photo

Stai commentando usando il tuo account Google. Chiudi sessione /  Modifica )

Foto Twitter

Stai commentando usando il tuo account Twitter. Chiudi sessione /  Modifica )

Foto di Facebook

Stai commentando usando il tuo account Facebook. Chiudi sessione /  Modifica )

Connessione a %s...