Announcements
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
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); } }
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); }
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();
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.
André Arnaud de Cal...
294,241
Super User 2025 Season 1
Martin Dráb
232,982
Most Valuable Professional
nmaenpaa
101,158
Moderator