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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

How to set first field on form load

(0) ShareShare
ReportReport
Posted on by 195

Hi there,

I would like the cursor to start in the ItemId field of the first sales line when I open up the SalesTable form. In firstField(), I have this:

public void firstField(int _flags=1)

{

   super(_flags);

   this.nextGroup();

}

My nextGroup() method looks like this:

void  nextGroup()

{

   info('In nextGroup()');

   if (!SalesLine::exist(salesTable.SalesId))

   {

       salesLine_ds.create();

   }

   salesLine_ItemId.setFocus();

}

When I open up the SalesTable form, I get the info message, then the cursor goes to the ItemId field, BUT THEN, the cursor goes to a field in the header.

How do I find out what is moving the cursor up there?

Thanks,

Tom

*This post is locked for comments

I have the same question (0)
  • Verified answer
    KLSI Profile Picture
    40 on at

    Hi,

    there are several reason for a changed focus in a form...

    However, to solve you issue, I would set the focus directly to the salesLine_ItemId control like this is done in salesLine_ds.create() (at least in AX 2012 R2 CU7). You could call salesLine_ItemId.setFocus() in SalesTable_ds.active() or linkActive(), depending on what you want to achive...

    Best regards

    Simon

  • tomhv Profile Picture
    195 on at

    Thanks, Simon!  I fixed this by using the linkActive() method on the SalesLine data source.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Sagar Suman Profile Picture

Sagar Suman 2 Super User 2026 Season 1

#1
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#1
Pratik Bhosle Profile Picture

Pratik Bhosle 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans