Question

Create a Customer Programattically

  • 8 January 2024
  • 3 replies
  • 79 views

Userlevel 2
Badge

I’m trying to create a new Customer from a custom screen and button, but having an issue when setting the CustomerClassID on the new Customer object:

 

                        CustomerMaint customerMaint = PXGraph.CreateInstance<CustomerMaint>();
                        Customer newAcumaticaCustomer = new Customer();
                        newAcumaticaCustomer.AcctCD = "RC1111";
                        newAcumaticaCustomer.Status = "A";
                        newAcumaticaCustomer.CustomerClassID = "REC01";
                        newAcumaticaCustomer.DiscTakenAcctID = 103;  
                        newAcumaticaCustomer.DiscTakenSubID = 29;        
                        newAcumaticaCustomer.StatementCycleId = "01";
                        newAcumaticaCustomer.StatementType = "O";

                        customerMaint.CurrentCustomer.Insert(newAcumaticaCustomer);

                        customerMaint.Save.Press();

 

The problem is that there is a popup about changing the Customer Class and pressing Yes/No doesn’t allow the customer to be created and the popup keeps happening.  Have tried:

 

             customerMaint.Answers.View.Answer = WebDialogResult.Yes;

 

With various changes and nothing seems to work.

Is there a way to create Customer similar to this?

 

Thanks All!


3 replies

Badge +18

Hello,

Acumatica prompts us with a popup about changing the Customer Class when we change the Class of an existing customer.

Are you sure that your new customer you are trying to add with ID RC1111 does not already exist as a customer in your tenant?

 

Laura

Userlevel 2
Badge

Yes, I can confirm that RC1111 does not exist as a customer in the tenant.  This is the post that led me to using code to confirm the popup: https://stackoverflow.com/questions/58402113/how-to-suppress-customer-class-update.  Not sure if that helps things become more clear?

 

Thanks for your reply!

Userlevel 7
Badge

Hi @asommer were you able to find a solution? Thank you!

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved