Home > Dynamics Ax > Dynamics Ax – Display the form with different colors for a particular control value

Dynamics Ax – Display the form with different colors for a particular control value


 

Displaying the form for different colors for salesId based on sales status.


Create the form and add the combo box and change the enum type to SalesStatus and select the modified write the following code:
public boolean modified()
{
    boolean ret;
    ret = super();
    salesTable_ds.executeQuery();
    return ret;
}

and place the grid attach to the SalesTable and write the following methods on the form

public class FormRun extends ObjectRun
{
    QueryBuildrange     mySalesStatus;
}

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;
    }
}

public void executeQuery()
{
    ;
    if (comboBox.selection())
        mySalesStatus.value(QueryValue(comboBox.selection()));
    else
        mySalesStatus.value(" ");

    super();

}

public void init()
{
    super();

    mySalesStatus = this.query().dataSourceNo(1).addRange(fieldnum(SalesTable, SalesStatus));

    salestable_ds.executeQuery();
}

This different article from AIF.  Island with a palm tree    Smile

Advertisements
Categories: Dynamics Ax
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: