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

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

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

    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.

  • Anthony90288 Profile Picture
    87 on at

    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);

  • Verified answer
    GirishS Profile Picture
    27,827 Moderator on at

    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.

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
Martin Dráb Profile Picture

Martin Dráb 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans