Monday, January 3, 2011

Create dialog without DialogRunbase class in Dynamics AX 2009

static void xppdialogWithOutRunBase(Args _args)
{
    Dialog          dialog;
    DialogField     df;
    CustAccount     custAccount;
    ;
    dialog      = new Dialog('My Dialog');
    df          = dialog.addField(TypeId(CustAccount));
    if (dialog.run())
    {
        custAccount = df.value();
        if (CustTable::exist(custAccount))
        {
            info(strfmt("Customer account: %1", custAccount));
        }
        else
        {
            throw error("Customer not found");
        }
    }
    else
    {
        throw error("sorry this function needs a customer");
    }
}

No comments:

Post a Comment