Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)
Suggested answer

Add ReferenceGroup X++

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

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

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add ReferenceGroup X++

    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 :(

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Add ReferenceGroup X++

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

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

    Please update if this information helps you.

  • Kenny Saelen Profile Picture
    Kenny Saelen on at
    RE: Add ReferenceGroup X++

    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)

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

Congratulations 2024 Spotlight Honorees

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December

Congratulations to our December super stars! 🥳

Start Your Super User Journey Pt 2

Join the ranks of our community heros! 🦹

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,820 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,514 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans