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

Find active tab / grid on form

(0) ShareShare
ReportReport
Posted on by 174

Hi,

how can I find which grid is currently active?

I've created a form with 4 grid every grid has a differend datasource.

I need to make a call based on the datasource of the active grid but how can I find which one is surrently running?

I have the same question (0)
  • huijij Profile Picture
    19,811 on at

    Hi RadekM,

    Please go through the blog about Loop through selected records in the grid with the multi-select helper class to get the active grid:

    d365ffo.com/.../

  • RadekM Profile Picture
    174 on at

    I don't see it would help me here. User can have selected records on all grids at once since they don't unselect while switching between grids.

  • RadekM Profile Picture
    174 on at

    I did find something like this but I cant get it on working or how should I really declare it...

    FormTabPageControl activeTabPage = DocumentHistoryMainTab.getActivePage();

    activeTabPage.caption();

  • Verified answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    You need set tab's autoDeclaration property to YES (Offcourse you need a tab and tabPages for each grid)

    Edit: I've never used this structure in 365, it may have been changed or completely removed. I've shared a similar approach below.

    community.dynamics.com/.../formactionpanetabcontrol-in-d365

  • Alex VN Profile Picture
    1,994 on at

    Hi,

    For this one I think you can user the cursor of the record to get the current record in the active grid then check for the type of that records or even get the DS name directly and create your own condition.

    You might use cursor and then datasource method of the called form to get the active records and ds.

    Hope this will help.

    Regards,

  • RadekM Profile Picture
    174 on at

    I've got one more question related to this topic.

    How can I manipulate the button properties on my form? Most of the methods I override dont recognize the autodeclared names of my buttons.

    So I end up doing something like below but there is still a problem that when the form runs on the default row  I can always use the button.

    [Control("Tab")]
        class DocumentHistoryMainTab
        {
            public void tabChanged(int _FromTab, int _ToTab)
            {
                super(_FromTab, _ToTab);
    
                FormTabPageControl tabPageControl = DocumentHistoryMainTab.getActivePage();
                pageName = tabPageControl.caption();
               
            }
        }
        
         [DataSource]
        class DocumentHistoryInvoice
        {
                public int active()
            {
                int ret;
            
                ret = super();
                ShowFile.enabled(true);
    
                if(pageName != '@SM:SM00259')
                {
                    ShowFile.enabled(false);
                }
                return ret;
            }
    
        }

  • Suggested answer
    ergun sahin Profile Picture
    8,826 Moderator on at

    You  can set first value via form control's property or you can set value with code at form's init  method (form will opened with default tabPage so you can set first value )

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
Abhilash Warrier Profile Picture

Abhilash Warrier 669 Super User 2025 Season 2

#2
André Arnaud de Calavon Profile Picture

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

#3
Martin Dráb Profile Picture

Martin Dráb 384 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans