web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Change record color in grid based on a display method

(0) ShareShare
ReportReport
Posted on by

Hello all,

I am attempting to create a modification to the WHSReleaseToWarehouse form where the grid control changes the record to a color based on a condition. I will be overriding the displayOption method in the datasource of the form.

The condition I was hoping to use is based on a display method. As I follow through the pattern for changing grid record colors I found that display method fields does not work.

For instance the below code errors out in the compiler. With the error "The table WHSInventTransSumDim does not contain the field displayQtyLeftToReleaseDelta." This is because the WHSInventTrnasSumDim is actually datasource named WHSInventTransSumDimSO and the field displayQtyLeftToReleaseDelta is the display method.

Can anyone recommend a way to use the display method in my condition?
Do I need to go down the route of creating a temp table?

public void displayOption(Common _record, FormRowDisplayOption _options)
{
    WHSInventTransSumDim        whsInventTransSumDimLocal;
   
    
    
    whsInventTransSumDimLocal    = _record;
    if (whsInventTransSumDimLocal.displayQtyLeftToReleaseDelta >= 1)
    {
        _options.backColor(WinAPI::RGB2int(255,255,0));//yellow
    }
    super(_record, _options);
}







*This post is locked for comments

I have the same question (1)
  • Verified answer
    Sohaib Cheema Profile Picture
    49,438 User Group Leader on at

    Hi Keith,

    How about trying  like following?

    Note:  Make sure to write your method under WHSInventTransSumDimSO DataSource

    public void displayOption(Common _record, FormRowDisplayOption _options)
    {
       
        if (this.displayQtyLeftToReleaseDelta(WHSInventTransSumDimSO) >= 1)
        {
            _options.backColor(WinAPI::RGB2int(255,255,0));//yellow
        }
        super(_record, _options);
    }
    


  • Community Member Profile Picture
    on at

    This did work. The record coloring still needs to be refined as the grid seems to be coloring more records than it should but I'll be able to move further. THANKS AGAIN Sohaib! I appreciate the response.

  • Community Member Profile Picture
    on at
    public void displayOption(Common _record, FormRowDisplayOption _options)
    {
        
        WHSInventTransSumDim       whsInventTransSumDimLocal;
        whsInventTransSumDimLocal    = _record as WHSInventTransSumDim;
        if (this.displayQtyLeftToReleaseDelta(whsInventTransSumDimLocal) > 0)
        {
            _options.backColor(WinAPI::RGB2int(255,255,0));//yellow
        }
        super(_record, _options);
    }


    Here is the fully working code for anyone's reference.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Priya_K Profile Picture

Priya_K 4

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#3
Sukrut Parab Profile Picture

Sukrut Parab 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans