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, ...
Answered

How to solve this, when open multiselectlookup in second time, firsttime marked values are not selected

(0) ShareShare
ReportReport
Posted on by

Hi,

I using this query,

public void lookup()
        {
            SysLookupMultiSelectCtrl        msCtrlCust;
            QueryBuildDataSource            qbds;
            super();

            Query                       query   = new Query();
            qbds                                = query.addDataSource(tableNum(DataArea));

            qbds.fields().addField(fieldNum(DataArea,id));
            qbds.fields().addField(fieldNum(DataArea,Name));
            msCtrlCust.
            msCtrlCust = SysLookupMultiSelectCtrl::constructWithQuery(element, MultiLookup, query);

        }

When I open the multi-select lookup in the second time, First time selected(preselected) or marked values are not selected.

 I need this option. Eg; the first time I selected 2 records in the lookup, again I need to select one more record, So I clicked the lookup in the second time  But now  I previously selected records are not selected in the lookup. So unfortunately I again selected 3 records in the lookup

Thanks.

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,429 on at

    Hi Ashok,

    Please try this code. It should work fine

    public void lookup()
    {
    	QueryBuildDataSource        qbds;			
    	container 					selectFields = conNull();
    	Query                       query   = new Query();
    	
    	qbds = query.addDataSource(tableNum(CompanyInfo));
    
        qbds.addSelectionField(fieldNum(CompanyInfo,DataArea));
        qbds.addSelectionField(fieldNum(CompanyInfo,Name));
    	
    	SysLookupMultiSelectCtrl::constructWithQuery(element, MultiLookup, query, false, selectedFields);
    }

  • Community Member Profile Picture
    on at

    Hi, Gunjan Bhattacharyya

    Thanks for this.

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

Congratulations to the August Top 10 Community Leaders

These are the community rock stars!

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

#1
Martin Dráb Profile Picture

Martin Dráb 539 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
CU-1234529-002 Profile Picture

CU-1234529-002 184

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans