Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Set grid for new record
Finance forum

Set grid for new record

(1) ShareShare
ReportReport
Posted on by 3,542

I was tasked to create a form with the data organized into months (like the Table of Contents form pattern).

I accomplished this by simply creating 12 grids on the 12 tab pages all linked to the same Form Datasource. And then I overrode the Tab.TabChanged(...) method to apply a month filter.

I know this is not standard, but I'm just a developer - following orders here.

The issue at the moment is that when the New button is clicked the form behaves inconsistently. If the current tab is January (the first tab page), everything is fine. But if the current tab page is something else the form jumps to January and does not create a new record.

My quick solution was to override the ActionPane's New button as such:

void clicked()
{
   JanuaryTabPage.activatePage();
   super();
}

Then if the current tab page is something else than January, the form will still jump to January, but at least a new record will be displayed.

How can I change the form's functionality so that a record can be created in any month? In other words no jump to the first tab page.

Thanks for reading

  • Verified answer
    Pete Alberts Profile Picture
    3,542 on at
    RE: Set grid for new record

    Nikolaos I tried your solution and I think it doesn't work because of the range I mentioned. However it did help me to understand why the issue is there.

    I implemented the following solution which works (it's gonna give me sleepless nights):

    void customNew() //normal button, not command button
    {
       MyTable newRecord = MyTable::createForCurrentRange(...);
       MyTable_ds.research();
       MyTable_ds.positionToRecord(newRecord);
    super(); }

    Thank you all


  • Pete Alberts Profile Picture
    3,542 on at
    RE: Set grid for new record

    Oh you meant chucking the tab pages. But that is the issue, my boss wants this design (I told him that if I had more experience I would've told him to stick with standard form patterns - RIP my salary).

  • Pete Alberts Profile Picture
    3,542 on at
    RE: Set grid for new record

    I am currently attempting to implement Nikolaos' suggestion. I suspect it won't work as the month filter is not on the root datasource but on a View joined to the datasource (the view generates the month integer - Martin you helped me with that one in another post).

    Then on your suggestion Martin. How would I implement that? One grid and one datasource but 12 tab pages? I wish I could understand straight away, but I don't....

  • Verified answer
    Martin Dráb Profile Picture
    231,925 Most Valuable Professional on at
    RE: Set grid for new record

    It would work as you want if you had a separate datasource for each tab and grid. Then you could also set ranges when initializing datasources, instead of handling it when switching tab pages.

    But having a single grid with a custom filter (where you would select the month) would make much better sense to me. Your design also shows only a single grid at any time, so what's the point of having eleven other grids?

  • Verified answer
    nmaenpaa Profile Picture
    101,156 Moderator on at
    RE: Set grid for new record

    It jumps to January because when you create a new record, the date field defaults to 1.1.1900. This is the "empty date" or null date in D365FO.

    If you want the record to show on some other page you must initialize the date to something else in initValue method. And of course then the date field will not appear empty.

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

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 293,245 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,925 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans