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

Community site session details

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

how to hide Lookup column in multiselect lookup

(0) ShareShare
ReportReport
Posted on by 58

hello,

I created a multi select lookup using event handlers and I got my output.

I wrote code for one lookup field called custAccount but when I select the drop down CustAccount values are came but also custGroup and name column also came

but i need only custAccount lookup column but automatically custGroup and name colomns are came i need to hide them because it is my requirement.

please help me to sort out this.

below I attached my code for reference.

CODE:

public class AatMultiSelect_Form_Handler
{
   

    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    [FormControlEventHandler(formControlStr(SalesTable, CustomerAccount), FormControlEventType::Modified)]
    public static void CustomerAccount_OnModified(FormControl sender, FormControlEventArgs e)
    {
        //FormRun formRun = sender.dataSourceObject().formRun();

        FormRun formRun = sender.formRun().dataSource().formRun();

        //FormRun     formRun = sender.datasource().formRun();

        SysLookupMultiSelectCtrl multiSelectCtl = formRun.parmMultiSelectCtl();

        SalesTable salesTable    =   formRun.dataSource(FormDataSourceStr(SalesTable, salesTable)).cursor() as SalesTable;
        salesTable.CustAccount   =   con2Str(multiSelectCtl.getSelectedFieldValues(), ';');
    }

    /// <summary>
    ///
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>


    [FormControlEventHandler(formControlStr(SalesTable, CustomerAccount), FormControlEventType::Lookup)]
    public static void CustomerAccount_OnLookup(FormControl sender, FormControlEventArgs e)
    {
        FormStringControl CustomerAccount;
        SysLookupMultiSelectCtrl multiSelectCtrl;
        FormRun formRun = sender.formRun();
        AatMultiSelect_Form_Handler msCtrlClass;


        CustomerAccount = sender.formRun().design().controlName(formControlStr(salestable, CustomerAccount));
 
        multiSelectCtrl = SysLookupMultiSelectCtrl::construct(formRun,
                                CustomerAccount,
                                queryStr(CustTableSRS),
                                false,
            [tableNum(CustTable), fieldNum(CustTable,AccountNum), false]);

        msCtrlClass.parmMultiSelectCtl(multiSelectCtrl);

        FormControlCancelableSuperEventArgs ce = e as FormControlCancelableSuperEventArgs;
 
        //cancel super() to prevent error.
        ce.CancelSuperCall();
    }

    public SysLookupMultiSelectCtrl parmMultiSelectCtl(SysLookupMultiSelectCtrl _multiSelectCtrl = multiSelectCtrl)
    {
        multiSelectCtrl = _multiSelectCtrl;

        return multiSelectCtrl;
    }

}

thanks,

Aathil Ameen  P

I have the same question (0)
  • Verified answer
    GirishS Profile Picture
    27,825 Moderator on at
    RE: how to hide Lookup column in multiselect lookup

    Hi Aathil Ameen,

    Account num, Cust Group and Name is shown because in the CustTableSRS query - Datasource >> CustTable >. Under field node you have Account num and Cust Group added >> Inside that DataSource you have DirPartyTable and it is having Name field. So, in the lookup you are seeing all the 3 fields.

    To avoid this, you need to duplicate the query and add Only CustTable as DataSource and add CustAccount as only field.

    You need to set the Dynamic Fields property to "No" on the DataSource level. Then only you can add your own fields.

    Later you can use that query instead of standard one.

    Thanks,

    Girish S.

  • Suggested answer
    Mohit Rampal Profile Picture
    12,563 Moderator on at
    RE: how to hide Lookup column in multiselect lookup

    Hi, Please check this article and instead of using CustTableSRS query, you can create query in code and add only CustAccount field in lookup.

    axhowto.wordpress.com/.../

  • AXDynamics365 Profile Picture
    58 on at
    RE: how to hide Lookup column in multiselect lookup

    Thanks Girish S

    Thanks Mohit Rampal. It will helps me.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,047

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 592 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans