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

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested answer

Programmatically set "Group by" in new grid

(0) ShareShare
ReportReport
Posted on by 87

Hello,

I am trying to programmatically use the Grid Group by feature in Dynamics 365 F&O to initialize a grid grouped by a certain column instead of the user selecting it from the user interface. I tried using the Group By grid property but it has no effect. Is it possible to use the new grid group by feature from the code and if so can it be done on multiple levels (multiple columns) to initialize the grid. Kindly advise. Thank you.

Grid capabilities - Finance & Operations | Dynamics 365 | Microsoft Docs - for reference about the new Grid Group by feature.

pastedimage1655727150507v1.png

pastedimage1655726556779v3.png

I have the same question (0)
  • Suggested answer
    huijij Profile Picture
    19,811 on at
    RE: Programmatically set "Group by" in new grid

    Hi Anthony90288,

    The UI feature can also support to group by multiple columns.would you specify your business requirements?

  • Anthony90288 Profile Picture
    87 on at
    RE: Programmatically set "Group by" in new grid

    Hi Judy,

    I am aware that the UI feature allows grouping up to 5 columns. However, my requirement is to have my grid already be grouped by a certain column programmatically on the initialization of my grid so that the user doesn't have to do it from the UI. I tried the "group by" grid property but it has no effect.

  • Mariano Gracia Profile Picture
    on at
    RE: Programmatically set "Group by" in new grid

    Why don't you just save the view and mark it as the default view?, you will achieve your proposal without a single line of code

  • Anthony90288 Profile Picture
    87 on at
    RE: Programmatically set "Group by" in new grid

    Hi Mariano,

    Thanks for your suggestion. I am also aware of using saved views and setting it as default. However, I have logic where users can change a certain field value which triggers execution of a query which uses a table that is the root data source of the grid and thus grid contents will change so the grouping will be undone each time it is executed. Therefore that is why I want to do it through X++ if possible. I basically want to replicate the group by functionality on the grid UI inside my executequery method if possible

  • Sebastian Aurand Profile Picture
    1,650 on at
    RE: Programmatically set "Group by" in new grid

    Hey Anthony,

    did you find a solution for this in the meantime? I'm facing exactly the same requirenment.

    Thanks in advance.

    Sebastian

  • Suggested answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: Programmatically set "Group by" in new grid

    Hi Sebastian,

    Refer to the below thread and see if it helps.

    https://community.dynamics.com/365/financeandoperations/f/dynamics-365-for-finance-and-operations-forum/478358/method-to-override-which-trigger-after-form-is-fully-loaded/1315898

    Thanks,

    Girish S.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,922

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 1,922

#3
André Arnaud de Calavon Profile Picture

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans