Skip to main content

Notifications

Finance | Project Operations, Human Resources, ...
Suggested answer

Multiselect lookup data is not updating

(0) ShareShare
ReportReport
Posted on by 75

I have added lookup method on StringEdit(InvoiceIdMultiselect) formcontrol as follows:

public void lookup()
{
    Query query = new Query();
    QueryBuildDataSource queryBuildDataSource;

    queryBuildDataSource = query.addDataSource(tableNum(VendInvoiceJour));
    queryBuildDataSource.addRange(fieldNum(VendInvoiceJour,PurchId)).value(PurchId.valueStr());

    queryBuildDataSource.addSelectionField(fieldNum(VendInvoiceJour, InvoiceId));
    queryBuildDataSource.addSelectionField(fieldNum(VendInvoiceJour, PurchId));

    msCtrl = SysLookupMultiSelectCtrl::constructWithQuery(this.formRun(), InvoiceIdMultiselect, query);

    //super();
}

On testing, when I am changing PO, lookup values are not updating,

Image

But when I am closing the form and reopening, it updates the data.

Any solution?

  • Ashraf_ahk Profile Picture
    Ashraf_ahk 75 on at
    RE: Multiselect lookup data is not updating

    Resolved

    public void lookup()
    {
        //super();
        Query query = new Query();
        QueryBuildDataSource qbdsVendInvoiceJour, qbdsVendTrans;
    
        qbdsVendInvoiceJour = query.addDataSource(tableNum(VendInvoiceJour));
        qbdsVendTrans       = qbdsVendInvoiceJour.addDataSource(tableNum(VendTrans));
        qbdsVendTrans.relations(true);
    
        qbdsVendInvoiceJour.addSelectionField(fieldNum(VendInvoiceJour, InvoiceId));
        qbdsVendInvoiceJour.addSelectionField(fieldNum(VendInvoiceJour, PurchId));
        qbdsVendInvoiceJour.addSelectionField(fieldNum(VendInvoiceJour, DueDate));
        qbdsVendTrans.addSelectionField(fieldNum(VendTrans, Voucher));
        qbdsVendTrans.addSelectionField(fieldNum(VendTrans, TransDate));
        qbdsVendTrans.addSelectionField(fieldNum(VendTrans, PromissoryNoteStatus));
    
        qbdsVendInvoiceJour.addRange(fieldNum(VendInvoiceJour,PurchId)).value(PurchId.valueStr());
    
        msCtrl = SysLookupMultiSelectGrid::construct(this,this);
        msCtrl.parmQuery(query);
        msCtrl.run();
        //msCtrl = SysLookupMultiSelectCtrl::constructWithQuery(this.formRun(), this, query);
    
    }

  • Suggested answer
    Vignesh.A Profile Picture
    Vignesh.A 203 on at
    RE: Multiselect lookup data is not updating

    Hi Ashraf,

    Override the modified method of your form control for which the lookup is crated and add the below code after super()

    this.text(con2str(msctrl.getSelectedFieldValues(), ';'));

    Note: your msctrl should be declared as global variable.

    You can refer the below post explaining the same for D365 FO

    dax365.blogspot.com/.../multi-select-lookup-in-d365-fo.html

  • Ashraf_ahk Profile Picture
    Ashraf_ahk 75 on at
    RE: Multiselect lookup data is not updating

    Yes I have tried but did not work.

  • Suggested answer
    Mohit Rampal Profile Picture
    Mohit Rampal 12,554 Super User 2024 Season 1 on at
    RE: Multiselect lookup data is not updating

    Hi Ashraf, Have you checked this thread. Hope it helps.

    community.dynamics.com/.../reset-selection-from-syslookupmultiselectctrl-when-create-new-record-in-from-data-source

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Congratulations to the January Top 10 leaders!

Check out the January community rock stars...

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,162 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 230,962 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans