Solved

Error: The item CustomerID is not found (restricted:False,external:True,value:xyz )

  • 13 April 2021
  • 8 replies
  • 644 views

Userlevel 4
Badge

Hi Team,

I have one processing screen, using which I am creating customer, then order using the created customer and then payment for the created order in the same process.

There is an inconsistent error “The item CustomerID is not found (restricted:False,external:True,value:xyz)” is coming at the time of payment creation. The strange thing here is the Customer is there in the system and Order is also created using the same customer but at the time of payment creation getting this error and that too not the case with all the records. As, for some of the records the flow is working fine from customer creation to order to payment.

Can anyone suggest something about the possible cause and resolution of this please.

 

Thanks in advance!

icon

Best answer by vivekm 19 April 2021, 18:06

View original

8 replies

Userlevel 7
Badge +10

Hi Vivek,

I have identified a few issues:

  • The primary view of the CustomerMaint graph is BAccount; you should be inserting your customer record into this view, and not the CurrentCustomer view
  • In your code, the CustomerID used in the payment is hardcoded:
objPayment.CustomerID = 7207;

I think you should be using the BAccountID of the customer that was just created:

objPayment.CustomerID = objCustomerEntry.BAccount.Current.BAccountID;
  • Is orderParams.paymentGraph equal to paymentGroup? In your code, you are doing this update, and orderParams is not declared anywhere else:
paymentGraph.Document.Cache.Update(orderParams.paymentGraph.Document.Current);

 

  • You can’t set the payment currency ID this way - CuryID value is not a string representation; anyway, it will be default from the customer after you set and update the record.
  • I don’t think you need or should be changing the payment status manually
  • You have a brand new graph instance -- no need to call .Clear on it.
  • You don’t need to use .Cache.Update -- you can use .Update directly on the view object
  • You should use PXGraph.CreateInstance to create the payment entry graph as well
Userlevel 7
Badge +10

Hi @vivekm,

Is this a custom processing screen?

Have you checked the Trace or turned on the Request Profiler to get the full exception details?

Userlevel 4
Badge

Hi @Gabriel Michaud,

yes, this is a custom processing screen.

yes, checked the trace and in trace having this information there: "The item CustomerID is not found (restricted:False,external:True,value:xyz)”. Also, checked the request profiler but did not get much details there too.

Userlevel 7
Badge +10

There’s nothing else, no stack trace with the error message? 

Are you creating the customer from the same connection, using the CustomerMaint graph?

Did you try stepping through the code ?

It would help if you shared high-level code showing how you create the customer and payment...

 

 

 

Userlevel 1

Good morning - I am running into this same issue.  My client is trying to run project billing and this error is being thrown.  I cannot find any inconsistency in the tables with regards to the BIZACCT (it is set to 6 characters as well as the customer ID schema).  The odd thing is that they have been able to produce invoices for this client in the past, but it just seemed to stop out of the blue.  Does anyone have a query or script I can use to see where the inconsistency may reside?  Thank you!

 

-Louise

Userlevel 4
Badge

Hi @Gabriel Michaud 

There’s nothing else, no stack trace with the error message? - Yes that’s correct in stack trace having only this info: "The item CustomerID is not found (restricted:False,external:True,value:xyz)”.

Are you creating the customer from the same connection, using the CustomerMaint graph? - Yes, that’s correct using this approach.

Did you try stepping through the code ? - Yes, trying with that.

It would help if you shared high-level code showing how you create the customer and payment. - Please find samples below for reference:

Customer Creation:

CustomerMaint objCustomerEntry = PXGraph.CreateInstance<CustomerMaint>();
                    Customer objCustomer = new Customer();
                    objCustomer.AcctCD = "Test";
                    objCustomer.AcctName = "Test";
                    objCustomer = (Customer)objCustomerEntry.CurrentCustomer.Cache.Insert(objCustomer);

                    objCustomer.MailDunningLetters = false;                   
                    objCustomer.Status = SOConstants.A;
                    objCustomer.Type = SOConstants.CU;
                    objCustomerEntry.GetExtension<DefContactAddressExt>().DefAddress.Current.BAccountID = objCustomer.BAccountID;
                    objCustomerEntry.GetExtension<DefContactAddressExt>().DefAddress.Current.AddressLine1 = "1110 S CANADIAN ST";
                    objCustomerEntry.GetExtension<DefContactAddressExt>().DefAddress.Current.AddressLine2 = "";
                    objCustomerEntry.GetExtension<DefContactAddressExt>().DefAddress.Current.City = "WHEELER";
                    objCustomerEntry.GetExtension<DefContactAddressExt>().DefAddress.Current.CountryID = "US";
                    objCustomerEntry.GetExtension<DefContactAddressExt>().DefAddress.Current.State = "TX";
                    objCustomerEntry.GetExtension<DefContactAddressExt>().DefAddress.Current.PostalCode = "79096-2325";
                    objCustomerEntry.GetExtension<DefContactAddressExt>().InitDefAddress(objCustomerEntry.GetExtension<DefContactAddressExt>().DefAddress.Current);

                    Contact contact = (Contact)objCustomerEntry.BillContact.Current;
                    contact.ContactType = ContactTypesAttribute.BAccountProperty;
                    contact.FirstName = "Test";
                    contact.LastName = "Test";
                    contact.DisplayName = "Test";
                    contact.EMail = "4gqlgsj4h8tvf@marketplace.com";
                    contact.Phone1 = "+1 763-225-9463 ext. 03717";
                    objCustomerEntry.BillContact.Update(contact);

                    var defLocation = objCustomerEntry.BaseLocations.Current;
                    objCustomerEntry.GetExtension<DefLocationExt>().DefLocation.SetValueExt<LocationExtAddress.locationBAccountID>(defLocation, objCustomer.BAccountID);
                    objCustomerEntry.GetExtension<DefLocationExt>().DefLocation.SetValueExt<LocationExtAddress.bAccountID>(defLocation, objCustomer.BAccountID);
                    objCustomerEntry.CurrentCustomer.Current = objCustomer;
                    objCustomerEntry.CurrentCustomer.Cache.Update(objCustomerEntry.CurrentCustomer.Current);
                    objCustomerEntry.Actions.PressSave();

 

Payment Creation:

    ARPaymentEntry paymentGraph = new ARPaymentEntry();
                    paymentGraph.Clear();
                    ARPayment objPayment = new ARPayment();
                    objPayment.DocType = ARDocType.Payment;
                    objPayment.Status = ARDocStatus.Balanced;
                    objPayment.CustomerID = 7207;
                    objPayment.PaymentMethodID = "CHECK";
                    objPayment.CuryOrigDocAmt = 17.92m;
                    objPayment.CuryID = "USD"; // Getting Currecncy issue so tried by setting this
                    paymentGraph.Document.Cache.Insert(objPayment); //Here itself the error is throwing

                    paymentGraph.Document.Current.ExtRefNbr = OrderExt != null ? OrderExt.UsrAmazonOrderID : order.OrderNbr;
                    paymentGraph.Document.Cache.Update(orderParams.paymentGraph.Document.Current);

                    SOAdjust adjnew = new SOAdjust();
                    adjnew.AdjdOrderNbr = order.OrderNbr;
                    adjnew.AdjdOrderType = order.OrderType;
                    adjnew.CuryAdjgAmt = order.CuryOrderTotal;
                    paymentGraph.SOAdjustments.Insert(adjnew);

                    paymentGraph.Actions.PressSave();

 

On debugging identified this error: “{"Error: An error occurred during processing of the field Currency: Error: 'CustomerID' cannot be found in the system."}”

 

Userlevel 7
Badge +17

Gabriel provided valid points above.

@vivekm  I’m assuming that you shared sample code, I don’t think you hardcoded “Customer ID”. Can you please share the actual Payment Creation code, which you are using?

 

Userlevel 4
Badge

Hi @Gabriel Michaud,

Thank you for the inputs.

The issue is resolved now, we checked the details and did some digging and found out it’s related to segmented keys and not with the code. The segmented key for customer is 10 and at the time of processing the customer details BAccount table has AcctCD value more than 10 characters but on UI on Customers screen it is showing up to 10 characters only and then leads to this issue.

 

Thanks @Naveen B.

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