Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

how to pull more than one value from lookup method

Posted on by 1,289

Hi,

I have custom fields in external items. these custom fields along with external itemid  are added in price discount/agreement tables.

In price discount/agreement tables, after selecting account relation and  Item relation, when i select drop down for external items, the drop down shows external items filtered with account relation and item relation. When I select the external itemid, I also want the custom fields to be populated in price discount/agreement tables. Unfortunately there is no primary index for external itemid (primary index is a combination of fields). 

Using x++ code, how should I pull the custom fields for the selected external item?

Thanks,

lakshmi

*This post is locked for comments

  • Verified answer
    Lifeisbelieveful Profile Picture
    Lifeisbelieveful 345 on at
    RE: how to pull more than one value from lookup method

    Hi, Lakshmi,

    Please refer to below scripts.

    I am writing most of my customized look up value referring it.

    public void lookup()

    {

       Query query;

       QueryBuildDataSource datasourceModule;

       QueryBuildDataSource datasourceLanguage;

       QueryBuildRange rangeElementType;

       QueryBuildRange rangeModuleId;

       SysTableLookup sysTableLookup;

       query = new Query();

       datasourceLanguage = query.addDataSource(tableNum(SysModelElement));

       datasourceModule = datasourceLanguage.addDataSource(tableNum(SysModelElement));

       datasourceModule.joinMode(JoinMode::InnerJoin);

       datasourceModule.relations(false);

       datasourceModule.addLink(

           fieldNum(SysModelElement, ParentModelElement),

           fieldNum(SysModelElement, RecId));

    datasourceModule.addRange(

           fieldNum(SysModelElement, ElementType)).value(int2str(UtilElementType::LabelFile));

    datasourceModule.addRange(fieldNum(SysModelElement, Name)).value(ModuleId.text());

       sysTableLookup = SysTableLookup::newParameters(tableNum(SysModelElement), this);

       sysTableLookup.addLookupfield(fieldNum(SysModelElement, Name));

       sysTableLookup.parmQuery(query);

       sysTableLookup.performFormLookup();

    }

    Thanks.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans