web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

To create new customer using dialog form

(1) ShareShare
ReportReport
Posted on by 1,836
hi every one , 
i want to create new customer using dialog form , i know in account reciavables all customer when we create new a dialog form opens where we create new customer , i want to create same but i need to create only three fields like customer name phone and email. and when i click on ok it create the new customer in all customer, can any one help me on this .
 
Thanks,
Regards,
Dinesh.
I have the same question (0)
  • Martin Dráb Profile Picture
    237,662 Most Valuable Professional on at
    To create new customer using dialog form
    Okay, so what do you need from us?
     
    Do you mean that you want to keep the standard dialog and add one more dialog triggered by a button instead of showing automatically on a record creation? Or do you want to actually replace the standard one? If the latter, isn't it easier to modify the standard dialog?
     
    In either case, you'll need default values for mandatory fields that you won't display, such as customer type and customer group.
  • Dineshkarlekar Profile Picture
    1,836 on at
    To create new customer using dialog form
    Hi ,
    martin thanks 
    for reply ,
    This dialog will work same as the dialogue in all customer , but i have to put is on another form in menuitem button control so when ever the user click the button the enter the values the new customer will be created and yes other values will be default as you said . below is my code can you please guide me on this . 
    class DT_SalesTableForm_CreateRetailCustomer_DK extends RunBase
    {
    
       
        DialogField    name,email,phone;
        DirPartyName      partyName;
        Email             custEmail;
        Phone             custPhone;
    
        public container pack()
        {
            return conNull();
        }
    
        public boolean unpack(container _packedClass)
        {
            return true;
        }
    
        Object Dialog()
        {
            Dialog dialog;
    
            dialog = super();
            // Set a title fordialog
            dialog.caption('Create Customer');
            // Add a new field to Dialog
            name = dialog.addField(extendedtypestr(DirPartyName),"Customer Name");
            email = dialog.addField(extendedtypestr(Email),"Customer Email");
            phone = dialog.addField(extendedtypestr(Phone),"Customer Phone");
            return dialog;
        }
    
        public boolean getFromDialog()
        {
            //Retrieve values from Dialog
            partyName = name.value();
            custEmail = email.value();
            custPhone = phone.value();
    
            return super();
        }
    
        public void run()
        {
            Dialog dialog;
            //Set Dialog field value to find CustTable
            if (dialog.closedOk())
            {
              //createRetailCustomer.getcustomer();
            }
    
        }
    
        public static void main(Args _args)
        {
            DT_SalesTableForm_CreateRetailCustomer_DK createRetailCustomer = new DT_SalesTableForm_CreateRetailCustomer_DK();
            if(createRetailCustomer.prompt())
            {
                createRetailCustomer.run();
            }
    
        }
       
    }
    
    thanks,
    Regards,
    Dinesh.
  • Martin Dráb Profile Picture
    237,662 Most Valuable Professional on at
    To create new customer using dialog form
    Well, I still don't know what is the problem you need help with. Please explain it.
  • Dineshkarlekar Profile Picture
    1,836 on at
    To create new customer using dialog form
    hi ,
    martin,
    Thanks for reply ,
    when my dialog opens it , i will fill these values and i want to create new customer using this values , as this dialogue is on another form so i have to do like this other fields are need to be fill with default values but i am stuck at how to create new customer on all customer form using these values and so when i click ok here on dialog the new customer get created on all customer form . 
     
    thanks,
    Regards,
    Dinesh
  • Martin Dráb Profile Picture
    237,662 Most Valuable Professional on at
    To create new customer using dialog form
    If I was you, I wouldn't try to reinvent the wheel. I would call the standard form (DirPartyQuickCreateForm), just I would pass a parameter from my menu item and change the behavior of the form based on the parameter.
     
    The fact that you have no idea how to create such a new form is an additional argument against doing it.
     
    If you insist on doing it in your code, there is an easier approach than dealing with all the tables (DirParty, LogisticsElectronicAddress etc.) directly. You could the use customer data entity (CustCustomerV3Entity) instead.
  • Layan Jwei Profile Picture
    8,097 Super User 2025 Season 2 on at
    To create new customer using dialog form
    Hi Dinesh,

    So in your current code what is is the issue you are facing so that we help you? are you getting an error? or is the customer not being created or what exactly?
    As martin said be aware that there are mandatory fields like custGroup...

    So what you could do, create a runnable class to create the customer and make sure it works properly, then utilize that code and put it in the correct place. (I also advice using CustCustomerV3Entity)

    Also Are those questions answered yet?
    https://community.dynamics.com/forums/thread/details/?threadid=c5bfb1ff-a3c1-ee11-9079-00224827e5d4
    https://community.dynamics.com/forums/thread/details/?threadid=e5c9c336-e2c0-ee11-9079-6045bdeb8873

    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Dineshkarlekar Profile Picture
    1,836 on at
    To create new customer using dialog form
     hi , martin 
    thanks for reply , 
    can i call the form  (DirPartyQuickCreateForm) in my code so i can pass these parameter in form to create new customer , can you please guide me on this , 
    what changes i have to de in my code .
     
     
    Thanks,
    Regards,
    Dinesh
  • Suggested answer
    Bharani Preetham Peraka Profile Picture
    3,634 Moderator on at
    To create new customer using dialog form
    Create a class and using CustTable insert method, which directly creates you account number and name where mandatory fields can be defaulted.
     
    Then make use of DirParty class and DirPartyContactInfoView view for creation of contact details.
  • Martin Dráb Profile Picture
    237,662 Most Valuable Professional on at
    To create new customer using dialog form
    Yes, you can call DirPartyQuickCreateForm from a menu item or code.
     
    CustTable isn't enough. For example, the name isn't in CustTable; it comes from DirPartyTable, therefore you must create a new record in a child of DirPartyTable (there is inheritance involved) before you can insert a record in CustTable.
  • Dineshkarlekar Profile Picture
    1,836 on at
    To create new customer using dialog form
    hi , everyone 
    Do i need to create the class and call the menu item in it and also should i call the entity or tables to insert values in when i create new record , please suggest me on this .
     
     
    Thanks,
    Regards,
    Dinesh

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

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 724 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 619 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 400 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans