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 :
Finance | Project Operations, Human Resources, ...
Answered

New record not creating at the end of the grid

(1) ShareShare
ReportReport
Posted on by 117

I am working on a form where end user can add a new item by pressing 'Add New' button. The problem is when a new item is created, it is not added at the bottom of the grid but at the start of the grid. 

I have changed StartPosition property on datasource to Last.

I have changed Insertatend property on datasource to yes.

I have added following code on the create method on datasource level:

formdatasource_ds.last();

After placing the above code, now the new records are being created at the second last place, right above the last record on the grid. 

It is important to mention that the Add New button is a command button with 'New' command which is set to create a new record in the grid. It has to do something with command button or now. If I need to replace command button with code, How can I create a new record on the grid using x++. can you share code for creating a new record ?? Thanks

I have the same question (0)
  • Verified answer
    00030000036294D5 Profile Picture
    117 on at

    The problem has been solved. I solved it by commenting out the super() of the click method of the command button and writing following code before the super():

    formDatasource_DS.last();

    formDatasource_DS.create(true);

    The first line of code brings the cursor at the last line on the grid. The second line of code creates a new row in the grid. So, it solves the problem.

  • Suggested answer
    Ruben Nys Profile Picture
    4 on at
    A more elegant way to do this is to just override the create method on the form datasource, so you don't have to change the function of the 'new' button itself.
    This way you can just call super(true), or even use it on existing forms as an extension by calling next create(true);
     
    public void create(boolean _append)
    {
        next create(true);
    }
    
    public void create(boolean _append)
    {
        super(true);
    }
     

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 > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 559 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 464 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 250 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans