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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

a control with the name already exists on the form when i build lookup with SysLookupMultiSelectCtrl

(0) ShareShare
ReportReport
Posted on by 25

Hello,

I want to make a contract parameter with MultiSelect, when i open dialogs for the first time, it's open without problem, but in my case I have to filter the multiselect based on another parameter contract, and so when I choose the value in the field on which I'm basing to filter the multi select and I open the lookup it gives this error 

"A control with the name 'Fld1_1_Ids' already exists on the form"

and error un this line

SysLookupMultiSelectCtrl::constructWithQuery(this.dialog().dialogForm().formRun(), WMSAisleIdDialog.control(), query, false, selectedFields); 

and exctly in this control WMSAisleIdDialog.control()

thank you

I have the same question (0)
  • Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Which version of AX is it about?

    Constructing SysLookupMultiSelectCtrl again sounds wrong to me. If I understand this correctly, you want to change the query and you should use refreshQuery() method for this purpose. It's available in F&O, at least.

    By the way, let me change the category from Other to Development / Customization / SDK.

  • Tool Consulting Profile Picture
    25 on at

    Yes, i'm in D365 F&O.

    and Yes yes I am based on the value of a parameter to filter the multi select lookup. so i change the query.

    please where can i use refreshQuery();

  • Tool Consulting Profile Picture
    25 on at

    public void lookupAisle()
        {
            Query					query		    = new Query();
            QueryBuildDataSource    qbdsWMSAisle     = query.addDataSource(tablenum(WMSAisle));
    
            if(strInventLocationId)
            {
                qbdsWMSAisle.addRange(fieldNum(WMSAisle, InventLocationId)).value(strInventLocationId);
                qbdsWMSAisle.fields().addField(fieldNum(WMSAisle, aisleId));
                qbdsWMSAisle.fields().addField(fieldNum(WMSAisle, InventLocationId));
                
            }
            else
            {
                qbdsWMSAisle.addRange(fieldNum(WMSAisle, InventLocationId)).value("");
                qbdsWMSAisle.fields().addField(fieldNum(WMSAisle, aisleId));
                qbdsWMSAisle.fields().addField(fieldNum(WMSAisle, InventLocationId));
            }
            
    
            container selectedFields = [tableNum(WMSAisle), fieldNum(WMSAisle, aisleId)];
    
            ctrlWMSAisleId = SysLookupMultiSelectCtrl::constructWithQuery(this.dialog().dialogForm().formRun(), WMSAisleIdDialog.control(), query, false, selectedFields);
        }

  • Verified answer
    Martin Dráb Profile Picture
    237,880 Most Valuable Professional on at

    Moved from Microsoft Dynamics AX Forum to Dynamics 365 Finance Forum.

    As I said, you should call constructWithQuery() just once. You already seem to have a class-level variable for it (ctrlWMSAisleId).

    When you want to use a different query for ctrlWMSAisleId, you can set it by calling refreshQuery() method. For example:

    public void lookupAisle()
    {
    	Query query = new Query();
    	QueryBuildDataSource qbdsWMSAisle = query.addDataSource(tablenum(WMSAisle));
    
    	qbdsWMSAisle.addRange(fieldNum(WMSAisle, InventLocationId)).value(queryValue(strInventLocationId));
    	qbdsWMSAisle.fields().addField(fieldNum(WMSAisle, AisleId));
    	qbdsWMSAisle.fields().addField(fieldNum(WMSAisle, InventLocationId));
    
    	if (ctrlWMSAisleId)
    	{
    		ctrlWMSAisleId.refreshQuery(query);
    	}
    	else
    	{
    		container selectedFields = [tableNum(WMSAisle), fieldNum(WMSAisle, AisleId)];
    		ctrlWMSAisleId = SysLookupMultiSelectCtrl::constructWithQuery(this.dialog().dialogForm().formRun(), WMSAisleIdDialog.control(), query, false, selectedFields);
    	}
    }

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 584 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 499 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 254 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans