Skip to main content
Solved

Using OData v4 to return INItemLotSerialKvExt for a given SOShipment


I have an SOShipment object and we store a value in INItemLotSerialKvExt.  We need to access the data via OData v4 and would like to get the value in a single call when accessing the SOShipment.  Essentially, for every SOShipLineSplit on the shipment, we want to get the INItemLotSerial → INItemLotSerialKvExt

 

Logically, it seems I could get this data like this: SOShipment → SOShipLineSplit → INItemLotSerial → INItemLotSerialKvExt.  But those navigation properties do not seem to exist in the OData schema.

 

Instead, the best I’ve been able to find is the following: SOShipment → SOShipLineSplit → INLotSerialStatusByCostCenter → INItemLotSerial → INItemLotSerialKvExt.  This seems a round about way of getting the value.

 

Here are the pertinent schema nodes for the links above:

            <EntityType Name="SOShipLineSplit">
                <NavigationProperty Name="INLotSerialStatusByCostCenterByLocationID" Type="PX.Objects.IN.INLotSerialStatusByCostCenter">
                    <ReferentialConstraint Property="LotSerialNbr" ReferencedProperty="LotSerialNbr" />
                    <ReferentialConstraint Property="InventoryID" ReferencedProperty="InventoryID" />
                    <ReferentialConstraint Property="SiteID" ReferencedProperty="SiteID" />
                    <ReferentialConstraint Property="LocationID" ReferencedProperty="LocationID" />
                </NavigationProperty>
            </EntityType>


            <EntityType Name="INLotSerialStatusByCostCenter">
                <NavigationProperty Name="INItemLotSerialByLotSerialNbr" Type="PX.Objects.IN.INItemLotSerial">
                    <ReferentialConstraint Property="InventoryID" ReferencedProperty="InventoryID" />
                    <ReferentialConstraint Property="LotSerialNbr" ReferencedProperty="LotSerialNbr" />
                </NavigationProperty>
            </EntityType>


            <EntityType Name="INItemLotSerial">
                <NavigationProperty Name="INItemLotSerialKvExtCollection" Type="Collection(SelectSires.Acumatica.DAC.AcumaticaDB.DAC.IN.INItemLotSerialKvExt)" />
            </EntityType>

 

When doing an OData v4 call to PX_Objects_SO_SOShipment, this $expand works:

$expand=SOShipLineSplitCollection($expand=INLotSerialStatusByCostCenterByLocationID)

But as soon as I try to go deeper, $expand=SOShipLineSplitCollection($expand=INLotSerialStatusByCostCenterByLocationID($expand=INItemLotSerialByLotSerialNbr))

I get the following error:

The request includes a $expand path which is too deep. The maximum depth allowed is 2. To increase the limit, set the 'MaxExpansionDepth' property on EnableQueryAttribute or ODataValidationSettings, or set the 'MaxDepth' property in ExpandAttribute.

 

Can someone please guide me to a way of getting the INItemLotSerial → INItemLotSerialKvExt for every SOShipLineSplit on a given shipment?

Best answer by Dmitrii Naumov

I’m afraid custom fields/attributes are not supported in OData v4, so retrieving it through a GI seems like a reasonable solution. 

View original
Did this topic help you find an answer to your question?

4 replies

Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6
  • Acumatica Moderator
  • 595 replies
  • September 3, 2024

@sclassing why do you need to access KvExt table? 

Normally these tables must not be accessible directly. The store translations/custom fields and must be accessible through their “parent” tables using appropriate methods. 


  • Author
  • Freshman I
  • 5 replies
  • September 4, 2024

@Dmitrii Naumov Are you referring to GetValueExt as described in this post?
 


We ended up solving it by exposing the value as a GI and accessing it via OData.  We then stitch the values together in the return SOShipment.  I’m not super happy with the approach as it requires two calls.  I’d love to find a way to include the value in the original OData v4 call if that’s possible.


Dmitrii Naumov
Acumatica Moderator
Forum|alt.badge.img+6
  • Acumatica Moderator
  • 595 replies
  • Answer
  • September 4, 2024

I’m afraid custom fields/attributes are not supported in OData v4, so retrieving it through a GI seems like a reasonable solution. 


  • Author
  • Freshman I
  • 5 replies
  • September 4, 2024

Ok, thanks, @Dmitrii Naumov 


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