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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Need filtered vendor data from released products to the add product form.

(0) ShareShare
ReportReport
Posted on by 266
Hello everyone,

This form is Inventory journal, while we create a new record i have added a new field called Vendor account, where we can able to see vendors in the look up and now if i open the record and click on add products button


you will be able to see all products. But i need to able to see the filtered product which user have chosen for the particular vendor.
The path as follows -> Released products ->Product(tab) -> set up -> variant workbench(click on the button). 

I wrote the code by using some query class but unable to achieve. can anyone help me on code? Thanks in advance.
 
I have the same question (0)
  • Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi Dishen,
     
    Can you please show us the code you wrote so far?
     
    Thanks,
    Layan Jweihan
  • Rafia Mohammed Profile Picture
    266 on at
    [ExtensionOf(formDataSourceStr(RetailAddItems,InventTable))]
    final class HHRetailAddItemsFDS_Extension
    {
        public void executeQuery()
        {
            this.query().dataSourceTable(tableNum(InventTable)).clearRanges();
            this.query().dataSourceTable(tableNum(InventTable)).clearLinks();
            this.query().dataSourceTable(tableNum(InventTable)).clearDynalinks();
            next executeQuery();
            if(this.formRun().args().dataset() == tableNum(InventJournalTrans))
            {
                InventJournalTable inventJournalTable;
                InventJournalTrans inventJournalTrans = this.formRun().args().record();
                         
                select HHVendId from inventJournalTable
                 where inventJournalTable.JournalId == inventJournalTrans.JournalId;
               /* if(inventJournalTable.HHVendId)
                {
                    QueryBuildDataSource qbds ;
                    qbds = this.query().dataSourceTable(tableNum(InventTable));
                    qbds.addLink(fieldNum(InventTable,Itemid),fieldNum(CustVendExternalItem,ItemId));
                    qbds.relations(true);
                    qbds.joinMode(JoinMode::InnerJoin);
                    qbds.addRange(fieldNum(CustVendExternalItem,ModuleType)).value(queryValue(ModuleInventPurchSalesVendCustGroup::Vend));
                    qbds.addRange(fieldNum(CustVendExternalItem,CustVendRelation)).value(queryValue(inventJournalTable.HHVendId));
                }*/
            }
        }
  • Suggested answer
    Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi Dishen,

    I opened the same form, by clicking add products from PurchLine. And I can see that there is a vendorAccount control already under the Hierarchy.
     
    Does it appear when you open it from the place you mentioned? if yes, can't you for example, pass the vendor account to this control in the "init" form method, and then call the vendor account "modified" method after so that the execute query is called by itself?

    Thanks,
    Layan Jweihan
  • Rafia Mohammed Profile Picture
    266 on at
    No, its only for inventory journal(created custom field called vendor), not applicable for other areas. guide me any sample code. Thanks. Or you want me to follow the code which u have suggested ?
  • Suggested answer
    Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi Dishen,
    ​​​​​​​

    I'm not talking about Inventory Journal. I'm talking about the "add Products" form itself (RetailAddItems).

    I saw that there is a vendor control in it already when I opened this form from PurchLine.
    ​​​​​​​
    So i wanted to say in the "Init" method of the form, you can fill this vendor control with the value coming from inventory journal and you can specify to do this only for your case(i mean not for purchline or salesline), then call the modifed method of the vendor control so that the query is executed.

    Maybe something like this, but replace PurchTable with what you need and replace vendor value from the value coming from InventJournalTable
    [ExtensionOf(formStr(RetailAddItems))]
    final class RetailAddItems_Extension
    {         
        public void init()
        {
            next init();
            if(this.args().dataset() == tableNum(PurchTable))
            {
                Vendor.text("11111");
                Vendor.modified();
                Vendor.enabled(false);
            }
    
        }
    }

    Would this achieve your requirmenet?

    Thanks,
    Layan Jweihan
  • Rafia Mohammed Profile Picture
    266 on at
    Okay let me try and come back . 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 608

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 591 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 430

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans