Skip to main content

Notifications

Announcements

No record found.

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 217

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

  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    Bharani Preetham Pe... 3,593 Super User 2024 Season 1 on at
    RE: calling "Group by this column" option of form grid when the form loaded

    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/.../

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: calling "Group by this column" option of form grid when the form loaded

    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.

  • Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: calling "Group by this column" option of form grid when the form loaded

    Can you provide more details on how the results are different

  • martinarul Profile Picture
    martinarul 217 on at
    RE: calling "Group by this column" option of form grid when the form loaded

    Hi Girish,

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

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: calling "Group by this column" option of form grid when the form loaded

    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.

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: calling "Group by this column" option of form grid when the form loaded

    Just type the control name in double quotes.

    FormGridControl.addGroupBy("ControlName1");

    Thanks,

    Girish S.

  • martinarul Profile Picture
    martinarul 217 on at
    RE: calling "Group by this column" option of form grid when the form loaded

    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

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: calling "Group by this column" option of form grid when the form loaded

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

    Check this article

    dev.goshoom.net/.../

  • Suggested answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: calling "Group by this column" option of form grid when the form loaded

    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.

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,234 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,994 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans