Skip to main content

Notifications

Announcements

No record found.

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.
 
  • Dishen Profile Picture
    Dishen 266 on at
    Need filtered vendor data from released products to the add product form.
    Okay let me try and come back . Thanks
  • Suggested answer
    Layan Jwei Profile Picture
    Layan Jwei 7,264 Super User 2024 Season 2 on at
    Need filtered vendor data from released products to the add product form.
    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
  • Dishen Profile Picture
    Dishen 266 on at
    Need filtered vendor data from released products to the add product form.
    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
    Layan Jwei 7,264 Super User 2024 Season 2 on at
    Need filtered vendor data from released products to the add product form.
    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
  • Dishen Profile Picture
    Dishen 266 on at
    Need filtered vendor data from released products to the add product form.
    [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));
                }*/
            }
        }
  • Layan Jwei Profile Picture
    Layan Jwei 7,264 Super User 2024 Season 2 on at
    Need filtered vendor data from released products to the add product form.
    Hi Dishen,
     
    Can you please show us the code you wrote so far?
     
    Thanks,
    Layan Jweihan

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! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans