Skip to main content
Question

Create a Customer Programattically


asommer
Jr Varsity III
Forum|alt.badge.img

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

Laura02
Captain II
Forum|alt.badge.img+19
  • Captain II
  • 3132 replies
  • January 8, 2024

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


asommer
Jr Varsity III
Forum|alt.badge.img
  • Author
  • Jr Varsity III
  • 21 replies
  • January 8, 2024

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!


Chris Hackett
Community Manager
Forum|alt.badge.img
  • Acumatica Community Manager
  • 2749 replies
  • March 11, 2024

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


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings