Skip to main content

Notifications

Dynamics 365 Community / Forums / Finance forum / Selection field return...
Finance forum
Suggested answer

Selection field returns wrong column label on lookup

Posted on by 58
Hello,
I'm trying to create a lookup but I have a difficulty setting the right labels for them.
 
Like below the label for CustomerRef field is totaly not what it should be. How can I fix it? Tried to change to addSelectionFieldWithAlias but I'm getting and error 'Query selection aliases are not supported in the native stack'
 
 
 fsCtrlMultiSelect = formRun.design().control(fbsCtrlMultiSelect.id());
           Query query = new Query();

           if(tableId == CustInvoiceJour.Tableid)
            {
                QueryBuildDataSource qbds = query.addDataSource(tableNum(CustinvoiceJour));
                qbds.addSelectionField(fieldNum(CustinvoiceJour, InvoiceId));
                qbds.addSelectionField(fieldNum(CustinvoiceJour, InvoiceDate));
                qbds.addSelectionField(fieldNum(CustinvoiceJour, OrderAccount));
                qbds.addSelectionField(fieldNum(CustinvoiceJour, InvoicingName));
            }
            else if(tableId == CustPackingSlipJour.TableId)
            {
                QueryBuildDataSource qbds = query.addDataSource(tableNum(CustPackingSlipJour));
                qbds.addSelectionField(fieldNum(CustPackingSlipJour, PackingSlipId));
                qbds.addSelectionField(fieldNum(CustPackingSlipJour, OrderAccount));
                qbds.addSelectionField(fieldNum(CustPackingSlipJour, SalesId));
                qbds.addSelectionField(fieldNum(CustPackingSlipJour, CustomerRef))
                //bds.addSelectionFieldWithAlias("reference", fieldNum(CustPackingSlipJour, CustomerRef));
                qbds.addSelectionField(fieldNum(CustPackingSlipJour, InvoicingName));
            }
            else
            {
                return;
            }

            msCtrl = SysLookupMultiSelectCtrl::constructWithQuery(formRun, fsCtrlMultiSelect, query);
 
  • RadekM Profile Picture
    RadekM 58 on at
    Selection field returns wrong column label on lookup
    I can't use it as a display because they need this field to filter.
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 5,815 Super User 2024 Season 2 on at
    Selection field returns wrong column label on lookup
    Hi,
     
    You can change the field label on the table level using extension, but you should know this will affect all screens that use the field in the system, another idea creates a display method that returns the field and use it instead of the field.
     
    Thanks,
    Waed Ayyad
    If this helped, please mark it as "Verified" for others facing the same issue
     
  • RadekM Profile Picture
    RadekM 58 on at
    Selection field returns wrong column label on lookup
    This label 
    is certainly not this 
     
    And the problem is bigger while I'm using a different language in AX than English.
    It doesn't even have the correct translate for me since it should show me something like 'User reference number' so nothing compareable to what actually is in this field stored. 
    CustPackingSlipJour, CustomerRef

    Users hate it and want me to add THIS field since the labels are so different so even while they see the data in this field is what they want it is just wrong for them and want to add the field they want.
  • Suggested answer
    Waed Ayyad Profile Picture
    Waed Ayyad 5,815 Super User 2024 Season 2 on at
    Selection field returns wrong column label on lookup
    Hi,
     
    Do you want to set a label for what? Can you show me screenshot of the lookup issue?
     
    Thanks,
    Waed Ayyad
  • Suggested answer
    Selection field returns wrong column label on lookup
    The alias is not used when SysLookupMultiSelect* builds the grid, notice the call to addDataField.
     
    I haven't found, and am unaware of, any generic multi-select lookups where you can specify your own labels.

    You will either have to create your own custom lookup form or develop your own SysLookupMultiSelect classes that extend from SysLookupMultiSelectCtrl and SysLookupMultiSelectGrid and can accept custom labels.

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

News and Announcements

Forum Structure Changes Coming Soon!

Quick Links

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,734 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 229,021 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,150

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans