Multiselect Dialog Lookup Error

I’m trying to make MultiSelectLookup Dialog to chose products/variants and insert the values from dialog in InventJournUpdateLines table. But after selection and pressing OK button I get the error
Field ‘Reference’ must be filled in.

The code of the dialog class:


 class DialogAddNewLine extends RunBase

DialogRunbase dialog;
DialogGroup dialogGrp;

FormBuildStringControl  fbsCtrlMultiSelect;
FormStringControl       fsCtrlMultiSelect;

container       returnIds;
InventJournNameId  journNum;
ProductTypes productTypes;

SysLookupMultiSelectCtrl    msCtrl;
/// <summary>
///    Returns the description from the current class by calling the static description method on the
///    class if there is one.
/// </summary>
/// <returns>
///    The description from the current class.
/// </returns>
/// <remarks>
///    This method can be overridden to give a more precise description, for example, when you need some
///    internal variables to build the description text.The static <c>RunBase::description </c> method is
///    generally used to obtain the description of a class because you do not have to instantiate the
///    class to call it. The method speeds up displaying the description in a grid, for example.
/// </remarks>
public ClassDescription caption()
    return 'Select product';

/// <summary>
///    Returns a class that contains the methods that are described by the <c>RunBaseDialogable</c>
///    interface.
/// </summary>
/// <returns>
///    A class that contains the methods that are described by the <c>RunBaseDialogable</c> interface.
/// </returns>
/// <remarks>
///    A dialog can be either built by using the <c>Dialog</c> class or by using a class that is created
///    in the Application Object Tree (AOT).
/// </remarks>
// Generate dialog
public Object dialog()
    FormBuildControl    setupGroupControl;

    dialog = super();

    dialogGrp = dialog.addGroup('Chose Product');

    setupGroupControl = dialog.formBuildDesign().control(dialogGrp.formBuildGroup().id());

    // Control with the MULTI-SELECT
    fbsCtrlMultiSelect = setupGroupControl.addControl(FormControlType::String, identifierstr(FormStringControl1));
    fbsCtrlMultiSelect.label('Select Item');



    return dialog;

public void dialogPostRun(DialogRunbase _dialog)
    FormRun formRun;


    formRun = _dialog.dialogForm().formRun();

    if (formRun)
        fsCtrlMultiSelect =;
        Query query = new Query();

        if (productTypes==ProductTypes::Product)
            QueryBuildDataSource qbds = query.addDataSource(tableNum(EcoResProductMaster));
            qbds.addSelectionField(fieldNum(EcoResProductMaster, DisplayProductNumber));
            qbds.addSelectionField(fieldNum(EcoResProductMaster, SearchName));                

            QueryBuildDataSource qbds = query.addDataSource(tableNum(EcoResDistinctProductVariant));
            qbds.addSelectionField(fieldNum(EcoResDistinctProductVariant, DisplayProductNumber));
            qbds.addSelectionField(fieldNum(EcoResDistinctProductVariant, SearchName));
        msCtrl = SysLookupMultiSelectCtrl::constructWithQuery(formRun, fsCtrlMultiSelect, query);

// Get input values
public boolean getFromDialog()

    // Return Ids from the  mutli-select control
    if (msCtrl)
        returnIds = msCtrl.get();

   // info('Control 1 - ' + con2StrUnlimited(returnIds,#SEMICOLON));

    return true;

public void run()
    int i;
    RefRecId ecoResRecId;
    InventJournUpdateLines lines;

    for (i=1; i<=conLen(returnIds); i++)

        ecoResRecId = conPeek(returnIds, i);
        lines.ProductLink = ecoResRecId;
        lines.JournNum = journNum;


public void parmInventJournNum(InventJournNum _inventJournNum)
    journNum = _inventJournNum;

static void main(Args _args)
    FormDataSource fds;
    Common record;

    DialogAddNewLine  d = new DialogAddNewLine();
    if(!_args || !_args.record() || _args.dataset()!=tableNum(InventJournUpdateHeader))
        throw error("Incorect parameter");

    d.parmInventJournNum(_args.record().(fieldNum(InventJournUpdateHeader, JournNum)));
    if (d.prompt())
        record = _args.record();
        fds = record.DataSource();

protected boolean canRunInNewSession()
    return false;


Can you show us the stack trace, please?

I’m not sure, i understood you right, i’m just a beginner at DAX - is that screenshot needed?
The call stack is empty even after the error is shown, i don’t know why:(

In .NET, exceptions are objects - instances of classes inheriting from System.Exception (or System.Exception itself). This class has several properties, such as Message or StackStack. The StackTrace property contains information about where the exception was thrown from, which is typically a crucial piece of information. That’s also what I meant. You can sometimes see $exception variable in the debugger, which you can expand and see its properties. You can also configure Visual Studio to stop debugging when a particular type of exception is thrown.
But there is also another approach usable in AX/F&O, which works too in most cases (although not all). When a message is added to infolog, Info.add() method gets called. Therefore you can add a breakpoint there, attach the debugger, run the process once more and if execution stops on the breakpoint, then you can check Call Stack window (as shown in your screenshot).

i got this one

Can you please post the complete information from Call Stack? I don’t see the method name.

I’m sorry, but it’s completely unclear to me what you’re showing. Your first previous screenshot was about JournActivationControllerClas… and when I asked for more details, you’re showing something about DialogAddNewLine class.
None of them seems to be related to what I was talking about.