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

Multiselect lookup value not saving in datasource/form

(0) ShareShare
ReportReport
Posted on by 349

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

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 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans