Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

How to get the list of vendors whose record type is person

Posted on by 75

Hi,

How can I get the list of vendors whose record type is person through X++ ?

Thanks

*This post is locked for comments

  • Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: How to get the list of vendors whose record type is person

    You are welcome!

  • DJosef Profile Picture
    DJosef 75 on at
    RE: How to get the list of vendors whose record type is person

    thank you so much Rustem

  • Verified answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: How to get the list of vendors whose record type is person

    You should write something like this (example of lookup() method on form control):

    public void lookup()
    {
        Query                   query;
        QueryBuildDataSource    qbds, qbds2;
        SysTableLookup          sysTableLookup =     SysTableLookup::newParameters(tableNum(VendTable), this);
    
        query = new Query();
        qbds  = query.addDataSource(tableNum(VendTable));
        qbds2 = qbds.addDataSource(tableNum(DirPerson)); 
        qbds2.addLink(fieldNum(DirPerson, RecId), fieldNum(VendTable, Party));
        qbds2.joinMode(JoinMode::ExistsJoin);
        
        sysTableLookup.addLookupfield(fieldnum(VendTable, AccountNum), true);
        sysTableLookup.addLookupMethod(tableMethodStr(VendTable, Name));
        
        sysTableLookup.parmQuery(query);
        sysTableLookup.performFormLookup();
    }


  • DJosef Profile Picture
    DJosef 75 on at
    RE: How to get the list of vendors whose record type is person

    Thank you Rustem,

    how can i adapt this job to make a lookup containing the vendors whose record type is person ?

  • Verified answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: How to get the list of vendors whose record type is person

    Hi DJosef!

    You should join DirPerson table to VendTable:

    static void Job211(Args _args)
    {
        VendTable   vendTable;
        DirPerson   dirPerson;
        
        while select vendTable
        exists join dirPerson
            where dirPerson.RecId == vendTable.Party
        {
            info(vendTable.name());
        }
    }


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,253 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,188 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans