Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Answered

Initialize Grid Group Reference control field

(0) ShareShare
ReportReport
Posted on by 87

Hello,

I have a group reference control that references the field Person from DirPerson as seen below. the field group AutoIdentification in the table HRMCourseAttendee contains two fields (hrmCourseId and Name). On a custom form, I have a grid where I am using this reference group control. How can I access and set the value of the fields in the group reference so that when the form is opened, the grid is prefiltered according to those values since I want to refine the results instead of displaying all the results.

pastedimage1672930051023v3.png

pastedimage1672929865677v1.pngpastedimage1672929898804v2.png

Note: I am able to access and set the value of any of the other fields by simply setting the value of the QueryBuildRange on the executeQuery method of the datasource but I am not sure how to set the values of the fields inside the Group Reference Control.

Thank you

  • Verified answer
    GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Initialize Grid Group Reference control field

    You need to understand one thing - Reference group control will show the user needed fields like Name etc. Instead of RecId.

    In SQL, reference group control field will be stored as RecId values only. It never stores like Course Id and name.

    You used the reference group control for HrmCourseAttendee table - So you need to pass the RecId of the table as query range.

    You cannot pass only the course id field only in the reference group control.

    Thanks,

    Girish S.

  • Anthony90288 Profile Picture
    Anthony90288 87 on at
    RE: Initialize Grid Group Reference control field

    Hi Girish,

    My goal is to just initialize the Course Id inside the reference group control (that has two fields - Course ID and Name).

    The following code initialized the course id to ''00001' only for the field HRMCourseId in the HRMCourseAttendee datasource and not the reference group control as shown below. How can I achieve this but for the Course ID shown in the group reference control. Thank you

    pastedimage1672994856728v1.pngpastedimage1672994885026v2.png

    QueryBuildDataSource qb;
    Range courseIDString;
    QueryBuildRange     courseRange;
        
    qb = this.query().dataSourceTable(tableNum(HRMCourseAttendee));
    courseRange = qb.addRange(fieldNum(HRMCourseAttendee, HrmCourseId));
    courseIDString = strFmt("%1", queryValue('00001'));
    courseRange.value(courseIDString);

  • GirishS Profile Picture
    GirishS 27,821 Super User 2024 Season 1 on at
    RE: Initialize Grid Group Reference control field

    Hi Anthonymgy,

    You need to pass the recid of DirPerson table to the reference group control.

    Its same as you are adding other ranges.Add the range to person field and In the query value you need to pass the recid of DirPerson table.

    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,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans