How to modify the dialogfield when other dialogField is changed using X++ in ax 2009


I’m trying to fetch bom name when we change Bom id in look up field from Item master form > Bom >lines> Create bom form

it is using dialog

How i can modify bom id field to show name for that selected bom id during run time?

  fieldNumber = dialog.addField(typeid(BOMId),"@SYS22298");
    fieldName       = dialog.addField(typeid(Name),"@SYS6303","@SYS50975");

Is it a RunBase class? If so, call dialog.allowUpdateOnSelectCtrl(true) in dialog() and then implement dialogSelectControl() method.

Otherwise I will have to override modified() method with dialog.dialogForm().formRun().controlMethodOverload() and dialog.dialogForm().formRun().controlMethodOverloadObject(). It’s cumbersome for sure, but that’s the price for working with such an old version.

No it is not using Runbase class

client static container promptCreateBOMDialog(boolean manual,
                                              BOMId   fromBOMId = ''
    Dialog              dialog;
    DialogField         fieldNumber;
    DialogField         fieldName;
    DialogField         fieldCopy;
    DialogField         fieldSite;
    boolean             multisite;

    dialog = new Dialog("@SYS25027");
    if (manual)
        fieldNumber = dialog.addField(typeid(BOMId),"@SYS22298");
    fieldName       = dialog.addField(typeid(Name),"@SYS6303","@SYS50975");

    if (fromBOMId)
        fieldCopy   = dialog.addField(typeid(NoYes),"@SYS12898","@SYS50976");
    multisite = InventParameters::find().MultiSiteActivated;
    if (multisite)
        fieldSite = dialog.addField(typeid(InventSiteId),"@SYS103211","@SYS103217");
        //added by sri
        if(BomTable::find(fromBOMId).SiteId == "Case")

    if (!
        return connull();

    // when multisite is activated, validate that the site is valid or empty
    if (multisite &&  fieldSite.value() && !InventSite::exist(fieldSite.value()) )
        checkFailed(strfmt("@SYS111931", fieldSite.value()));
        fieldSite = null;
    return [manual ? fieldNumber.value() : '', fieldName.value(), fromBOMId ? fieldCopy.value() : NoYes::No, fieldSite ? fieldSite.value() : ''];

I have no idea how to do this, please help

I told you to use controlMethodOverload() and controlMethodOverloadObject(). Therefore you should have used a search engine (or cross-references) to find out how to use them.

Here is such an example found by searching for ax controlMethodOverloadObject modified.

I got many links like that but the problem is they used in class but here I want to use in a table method.
I’m trying to incorporate
Is it possible to do the same in table method instead of class?

I think it wouldn’t work and even if it did, it would be a bad idea, therefore I wouldn’t even try it. Encapsulate the logic in a class.

how can i pass my dialog from table method to class. it is working individually but how can I run this for my dialog

What do you mean? The link is about building a RunBaseBatch class and one part of it is a dialog. if you do that, you don’t pass a dialog to the class - it’s the class that build the dialog. I’m also not sure what you mean by “run this for my dialog”. If “this” means the RunBaseBatch class, than again, your dialog is created in the class, and then it executes run() method. But I thought you wanted only a dialog; RunBaseBatch is much more than that.

If you mean how you can integrate a custom dialog into promptCreateBOMDialog(), I think the approach will the least changes may be using a custom class extending from Dialog. Then you’ll replace just one statement: new Dialog("@SYS25027").

in promptCreateBOMDialog() dialog exists, for that dialog how can i call that class.
how can i make that class run for this dialog

I don’t wanna build a dialog in class, i want to run class with modified for dialog from promptCreateBOMDialog() method

I’m sorry, but it’s not clear to me what you’re talking about.