Solved

CustomerLocation is failing when retrieving data

  • 13 February 2024
  • 9 replies
  • 98 views

Hi everyone,

When sending a GET request for the CustomerLocation with a LocationID the API fails with the following error “Operation is not valid due to the current state of the object." However, if the LocationID is removed the request will succeed. Meanwhile, every other object like CustomerPaymentMethod requires an ID or they will fail and report the same error.

  1. Why is CustomerLocation different ?
  2. Is it possible to detect if a ID is supported in the API ?


I am using version 23.200.001 and the Default endpoint.

Thank you.

icon

Best answer by Dmitrii Naumov 20 February 2024, 16:12

View original

9 replies

Userlevel 7
Badge +5

@Jedanif 

the ID is/must be supported for every entity (except for inquiries). 

Could you please post the complete URL that causes the error?

Userlevel 7
Badge +5

@Jedanif  referencing a record by GUID is supported for all top level entities

Userlevel 7
Badge +4

@Jedanif 

I believe you need to pass both CustomerID and LocationID for this to work properly:

 

Userlevel 7
Badge +5

@Jedanif ok, I see. 

So, there are two ways of referencing a record.

  1. ID. In that case the ID is a guid value that is returned to you in “id” field of the API response. This is not the value you are sending, as you are sending “Location ID”, which is “user-friendly” identifier of the object and not the GUID value.
  2. Using full keys of the object. In that case you need to follow the example @RohitRattan88 has provided, since the Location object has two key fields - CustomerID and LocationID

 

 

@Dmitrii Naumov 

 I tested with the GUID value and now I can retrieve data (for the CustomerLocation_LocationContact view) but if I use the GUID in another table that has composite keys like Bill_TaxDetails an error will be thrown.

 

  • Should GUID filtering be supported across the platform?
  • If no, what qualifies a view to be filtered using GUID?

@Dmitrii Naumov any thoughts ?

Userlevel 7
Badge +5

@Jedanif and for the ID, what value do you have?

@Dmitrii Naumov I tried multiple values and none worked for the LocationID, an example would be LocationID = ‘TX-DAL’.

 

@RohitRattan88 I will try with both IDs and get back to you.

 @Dmitrii Naumov 

The URL:

.../entity/Default/23.200.001/CustomerLocation/{id value}?$select=LocationID,LocationContact,LocationContact/NoteID&$expand=LocationContact&$Custom=LocationContact/Address.Latitude,LocationContact/Address.Longitude,LocationContact/Address.NoteID,LocationContact/Contact.FaxType,LocationContact/Contact.NoteID

 

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