Solved

Get Address by Default address id for Branch in OData V4

  • 2 December 2021
  • 7 replies
  • 389 views

  This may be a simple question, but I am not having any luck finding the information I need online or in the documentation.  I am trying to use OData V4 to get information from the Branch screen, and I am trying to locate the default address information.  When I try to follow the example from the training material (I300 Data Retrieval with OData 2021 R2), it tells me for the AR Customer to expand using "AddressByDefAddressID".  I tried this for the PX_Objects_GL_Branch entity and I get an error saying "The query specified in the URI is not valid. Could not find a property named 'AddressByDefAddressID' on type 'PX.Objects.GL.Branch'.".  My question is, where can I go in Acumatica, or in the documentation to find what is available for each entity? 

 

------------------------------(I300 Data Retrieval with OData 2021 R2)------------------------------------------

The PX.Objects.AR.Customer entity contains common information about a customer. The
ContactByDefBillContactID navigation property of the PX.Objects.AR.Customer entity refers to the
contact information contained in the PX.Objects.CR.Contact entity. Also, the AddressByDefAddressID
navigation property of the PX.Objects.AR.Customer entity refers to the address contained in the
PX.Objects.CR.Address entity. In the request provided in this topic, you will select the following fields of the
entities:
• The AcctCD, AcctName, and CustomerClassID fields of the PX.Objects.AR.Customer entity
• The Email and Phone1 fields of the PX.Objects.CR.Contact entity
• The AddressLine1, AddressLine2, City, State, and PostalCode fields of the
PX.Objects.CR.Address entity
In the $select parameter, you list every field you want to provide in the result. In the $expand parameter,
you specify every nested entity you want to provide in the result. For nested entities, you specify their $select
parameters (and other parameters used as well) in parentheses.

icon

Best answer by jinin 6 December 2021, 19:21

View original

7 replies

Userlevel 7
Badge +11

Hi @edwolfer60 

I think its not possible to get the details by using ‘AddressByDefAddressID’. But we can achieve by using the Generic Inquiry. 

  1. Create GI with Address, Branch and BAccount tables. Make the Expose via Odata checkbox as checked.
  1. Add the Relations 
  1. Add the required fields on the Result grid.
  1. Use the below request,  
           Request -  Url/OData/GIName?$format=json

          Method - GET

 

 

Thanks jinin :

  I appreciate you taking the time to respond. I was aware that I could make a Generic Inquiry, but I appreciate you laying it out for me.  My main question is more about where to find documentation on what is available for a given entity?  I am trying to utilize the OData V4 objects as much as possible, but I am just not sure where to find a catalog of what data is available for each entity?  Any help in this area would be greatly appreciated.

 

Ed W.

Userlevel 7
Badge +17

Hi @edwolfer60  I hope below steps will helps you to get the each entity details from Acumatica screen it self. Please find the details below.

  • Inspect the Element (Cntrl + Alt + Click)
  • Click on the Actions dropdown
  • Then click on the “Data Class Source Code”, it will be redirected to Source Code screen and there you can see the fields of each entity.

 

 

Userlevel 7
Badge +11

Hi @edwolfer60 

Am also searched any document explained about this, But no such document explained how to get the navigation properties to retrieve data.

Acumatica help topics provided some details about this, but not explained with this info.

 

As per my understanding and seeing the below samples, its added like table name with the key fields(retrieves record along with their address, contact, customer information) and  table name with collections (retrieves records along with their details)

ContactByDefBillContactID
AddressByDefAddressID
INSiteByDfltSiteID
INItemClassByItemClassID
InventoryItemByInventoryID
SOLineCollection
INSiteStatusCollection 

In the Branch table, We don’t have direct association with the AddressID or ContactID. We need to get this from the BAccount table. That’s why we are unable to get the details directly.

​Hope this help you.

Userlevel 7
Badge +9

Hi @edwolfer60 Please advise if your query is addressed. Or Else, requesting you to elaborate so that we can try to provide a Solution.

Thanks

@ChandrasekharM  - Yes and no.  My original question was answered as far as how I get the default address for a branch, but the bigger question of how do I find what methods are available for the entities in the web services is still not answered.  As mentioned by @jinin, there are some specific examples in the training material and online help, but there doesn’t seem to be a place to go look at a particular entity and find what is available.  For example, I am looking at the Vendor object ( https://localhost/MyStoreInstance/odatav4/PX_Objects_AP_Vendor), but I want to see the AP Account and sub Account, but all I can get is the ID numbers, not the actual values, which is what I need.  I was hoping there would be some documentation, or someplace I can look in Acumatica about what is available for each web service object.

 

Userlevel 7
Badge +11

Hi @edwolfer60 

If you use DAC to retrieve the data, it will provide DB values only. If you want to get the actual values(CD), better to try with GI. It will provide the actual value.

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