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, ...
Suggested Answer

calling "Group by this column" option of form grid when the form loaded

(0) ShareShare
ReportReport
Posted on by 223

Hi Friends,

I want call the "Group by this column" option when the form is loaded and show the grid to the user grouped by that particular column in x++ code. Can you provide some hint for the code and the place where the code can written.

image

I have the same question (0)
  • Suggested answer
    GirishS Profile Picture
    27,827 Moderator on at

    Hi Martin,

    On the FormGridControl there is a method named groupBy(controlName). Use this method to add a groupBy of the grid.

    Add this code on the init method of the form.

    Get the grid control and control to group by in the OnInitialize event handler of the form.

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,565 Moderator on at

    Hi, You can add group by in ExecuteQuery method of form datasource

    Check this article

    dev.goshoom.net/.../

  • martinarul Profile Picture
    223 on at

    Hi Girish,

    Thanks for the reply.

    I tired GroupBy method the way you suggested. Actually the parameter to be passed for the method GroupBy is string.

    when I tried to pass the control name, it gives error saying 'The required type is string but the actual type is formstringcontrol'

    what string should I pass in the parameter?

    Regards

    Martin

  • GirishS Profile Picture
    27,827 Moderator on at

    Just type the control name in double quotes.

    FormGridControl.addGroupBy("ControlName1");

    Thanks,

    Girish S.

  • GirishS Profile Picture
    27,827 Moderator on at

    Are you able to solve this?

    Use name method to get the name of the particular control.

    I tried in the standard form it's not working. I tried it in different method also it's not working.

    Its working on custom form where its open with group by enabled and also, I think it works on latest version only.

    I think it works only for custom form only not for standard forms.

    Thanks,

    Girish S.

  • martinarul Profile Picture
    223 on at

    Hi Girish,

    Its working in custom forms, but its not producing same results as manual grouping

  • Mohit Rampal Profile Picture
    12,565 Moderator on at

    Can you provide more details on how the results are different

  • GirishS Profile Picture
    27,827 Moderator on at

    I think it won't work in standard form. It will work only in custom form.

    If you find any solution to this in future, please post it here so it will be useful for others.

    Thanks,

    Girish S.

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at

    Is it the requirement to call it by x++ code only? Because this can be simply done by Feature management. Please check this blog.

    sathishd365.wordpress.com/.../

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