How to create dialog box in D365

 class Class1 extends RunBase

{

    

    DialogField fieldAccount;


    DialogFIeld fieldName;


    CustTable   custTable;


    CustAccount custAccount;


    CustName custName;


    public container pack()


    {


        return conNull();


    }


    public boolean unpack(container _packedClass)


    {


        return true;


    }


    Object Dialog()


    {


        Dialog dialog;


        dialog = super();


        // Set a title fordialog


        dialog.caption( 'Simple Dialog');


        // Add a new field to Dialog


        fieldAccount =dialog.addField


       (extendedTypeStr(CustAccount), 'Customer account' );


        return dialog;


    }


    public boolean getFromDialog()


    {


        // Retrieve values from Dialog


        custAccount =fieldAccount.value();


        return super();


    }


    public void run()


    {



        //Set Dialog field value to find CustTable


      

  custTable = CustTable::find(custAccount);

        if (custTable)


        {


            // Shows retrieved information


            CustCustomerV3Entity cust;


           while select * from cust where cust.CustomerAccount== custTable.AccountNum

            {

             

            info( strFmt('%1 -- %2' ,cust.PrimaryContactPhone, cust.FullPrimaryAddress));


            }

        }


        else


        {


            error( 'Customer Account not found!');


        }


    }


    public static void main(Args _args)


    {


        Class1 custDialog = new Class1();



        if(custDialog.prompt())


        {


            custDialog.run();


        }


    }


}

Comments

Popular posts from this blog

How to Create a wizard in x++ d365

how to post trade agreement journals automatically using x++ code

X++ code to CREATE AND POST A TRADE AGREEMENT IN MICROSOFT DYNAMICS 365 in D365 F & O