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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Setting focus\highlighting particular grid row in dynamics AX

(0) ShareShare
ReportReport
Posted on by 110

Hi,

I have a requirement where I have to set focus (highlight) on a particular sales order record in the form's grid (FormB).

FormB receives salesId (of the recod to be selected) as an args parameter (from FormA).

I have written below code in FormB's init() method, but can't get it to work. Could someone please suggest:

public void init()
{
    SalesTable sl;
    super();
    sl = SalesTable::find('SO-XXXXXX');
  
    salesTable_ds.research();
    salesTable_ds.findRecord(sl);

}
 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Bashir Ahmad Profile Picture
    5,248 on at

    You can create an extra table buffer variable and fill it with the record you want to set focus on then run the following line of code: yourDataSource_ds.findRecord(yourNewTableBuffer); so if for example we are in SalesTable and yournewTableBuffer has the record with sales id: so_01122 then the grid focus will go on that record.

  • Verified answer
    Ivan (Vanya) Kashperuk Profile Picture
    on at

    findRecord() is one of the ways to go.

    You are using it a bit wrong however.

    You are trying to find a record in the datasource, which is right. But you are calling it too early, the data has not been retrieved yet (it happens in executeQuery() of the datasource)

    However, findRecord() is very slow, and Microsoft generally speaking considers its use a bad practice.

    Consider, instead, using the lookupRecord() method on the args class when calling FormB

    stackoverflow.com/.../dynamics-ax-2009-go-to-main-table-form-how-to-select-the-default-row

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

News and Announcements

Season of Giving Solutions is Here!

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
TAHER Mehdi Profile Picture

TAHER Mehdi 3

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#2
Nakul Profile Picture

Nakul 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans