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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)
Suggested Answer

Add ReferenceGroup X++

(0) ShareShare
ReportReport
Posted on by

Hi,

i am trying to add a ReferenceGroup control on a form. For any other control type this works easily with the following code: 

FormStringControl   strCtrl;

strCtrl = element.design().addControl(FormControlType::String, 'tmp');
strCtrl.extendedDataType(extendedTypeNum(CustAccount));

If i try this for a ReferenceGroup control, the control is added (right click -> personalize does show it, although it doesn't appear on the form), but the form is empty

FormReferenceGroupControl       ctrl;

ctrl = element.design().addControl(FormControlType::ReferenceGroup, 'tmp');
ctrl.extendedDataType(extendedTypeNum(SalesTaker));

Adding the ReferenceGroup manually on the form with the EDT set to SalesTaker works fine, so i guess im missing something?

*This post is locked for comments

I have the same question (0)
  • Kenny Saelen Profile Picture
    Microsoft Employee on at

    I know you shouldn't have to do this, but have you tried filling in the property that specifies the field group in the relating table.

    (By default the kernel takes the AutoIdentification group of the referenced table, but try to put it in the property of the control)

  • Suggested answer
    Community Member Profile Picture
    on at

    Please review following link for more details related to ReferenceGroup Control.

    msdn.microsoft.com/.../gg845085.aspx

    Please update if this information helps you.

  • Community Member Profile Picture
    on at

    Specifying the replacementFieldGroup doesn't help either, but actually i am more close to the issue now:

    I just wrote a simple job with one dialog field. This does actually work fine, as expected

       Dialog              dialog      = new Dialog();

       dialog.addField(identifierStr(SalesTaker));

       dialog.run();

    The difference is, that in DialogField\init FormBuildControls are used. So i just modified the init like this:

    public void init()

    {

       FormBuildReferenceGroupControl  buildCtrl;

       buildCtrl       = element.form().addControl(FormControlType::ReferenceGroup, 'tmp');

       buildCtrl.extendedDataType(extendedTypeNum(SalesTaker));

       super();

    }

    That does actually work, BUT if i try to modify the control after super(), the control isn't updated.

    public void init()

    {

       FormBuildReferenceGroupControl  buildCtrl;

       FormReferenceGroupControl       ctrl;    

       buildCtrl       = element.form().addControl(FormControlType::ReferenceGroup, 'tmp');

       buildCtrl.extendedDataType(extendedTypeNum(SalesTaker));

       super();

       ctrl            = element.design().controlName('tmp');

       ctrl.extendedDataType(extendedTypeNum(DirPartyRecId));    

       //ctrl.resolveReference();

    }

    Calling resolveReference() does open the correct lookup, but lookupReference() results in an infolog message.

    There seems to be no way to update the reference or i didn't find it yet :(

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the June Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans