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

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?

  • Suggested answer
    Mohit Rampal Profile Picture
    12,573 Moderator on at
  • Ashraf_ahk Profile Picture
    75 on at

    Yes I have tried but did not work.

  • Suggested answer
    Vignesh.A Profile Picture
    203 on at

    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
    75 on at

    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);
    
    }

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

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

#1
Martin Dráb Profile Picture

Martin Dráb 510 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 302 Super User 2026 Season 2

#3
CU-1234529-002 Profile Picture

CU-1234529-002 197

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans