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

Multiselect lookup value not saving in datasource/form

(0) ShareShare
ReportReport
Posted on by 351

Hi.

I created a new field "BillType" in RetailParameters which will have multiselect lookup in RetailParameters form.I am able to select multiple values from the lookup but on clicking Save button or on refreshing the page the selection dissappears.

I want to save the values selected in the RetailParameters datasource so that I can fetch it later in my report based on the selection .

Please help me find what I am missing.

FYI. Form String control: BillType_InfoCode (auto declaration set Yes, Datasource,datafield not set)

1.In form extension class:
 public SysLookupMultiSelectCtrl msCtrlCust;
        public void init()
    {
        FormRun             formRun = this;
        //FormStringControl BillType_InfoCodeCtrl = formRun.design().controlName(formControlStr(RetailParameters, BillType_InfoCode));

        Query query = new Query();
        QueryBuildDataSource qbds;
        TableId     multiSelectTableNum = tableNum(RetailParameters);
        container   selectedFields      = [multiSelectTableNum, fieldName2id(multiSelectTableNum, fieldStr(RetailParameters,Billtype))];

        next init();
        
        qbds = query.addDataSource(tableNum(RetailInfocodeTable));
        qbds.fields().dynamic(true);
        qbds.fields().addField(fieldNum(RetailInfocodeTable,infocodeId));
        qbds.fields().addField(fieldNum(RetailInfocodeTable,description));
        //qbds.relations(true);
        //assigning control and query to the class
        msCtrlCust = SysLookupMultiSelectCtrl::constructWithQuery(formRun,BillType_InfoCode , query);
    }

    public void SetCustGroupLookpValues()
    {
        container ids;
        container recIds;
        int i;
        RetailParameters retailParameters;

        for(i=1;i<=conLen(str2con(retailParameters.BillType,';')); i  )
        {
            recIds  = RetailParameters::find(conPeek(str2con(retailParameters.BillType,';'),i)).RecId;
            ids  = conPeek(str2con(retailParameters.BillType,';'),i);
        }
        msCtrlCust.set([recIds,ids]);
        ids = conNull();
        recIds = conNull();
    }
   
   2.In form control class
   public boolean modified()
    {
        boolean ret;
        RetailParameters retailParameters;
        ret = next modified();

        ttsBegin;
        retailParameters.BillType = this.text();
        retailParameters.write();
        ttsCommit;

      
        return ret;
    }
    
    3.In form datasource class
    public int active()
    {
        int ret;

        ret = next active();

        element.SetCustGroupLookpValues();

        return ret;
    }

I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 692

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 532 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 478

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans