Key Line items properties are not returned in custom code

Hello,

I am working with custom code and the Line Item API. I used the key and accessed Line Item properties, such as quantity, name, etc. However, no matter what I try, it doesn’t return any values. I have rewritten the code multiple times, but it consistently returns “undefined” for every property of the Line Item. I’m attaching screenshots of my latest attempt.

Currently, I am using a workaround, but I really need this feature to work as expected; otherwise, it will be nearly impossible to achieve the desired results.

Thank you.

Знімок екрана 2024-10-31 213837.png

@ODeikun - I’m having some difficulty understanding the code framents and other data you have posted here. But I believe that you may need to consider a change in strategy to get to the line item data.

Line items are not directly refreenced in the deal record, but are a set of records associated to the deal record. To obtain a list of thesse associations your initial custom cose would ned to call an assocations API call:

https://api.hubapi.com/crm/v4/objects/{objectType}/{objectId}/associations/{toObjectType}

This will give you a list of record IDs that you can use in your line item API calls.

Hope this helps!

Steve