Get data from all associated Line Items in workflow

Hi there,

I’m trying to create a workflow that sends information associated with a deal using a webhook. I need to get the information for all Line Items, including the SKU, Quantity, and Unit Cost.

When I edit the available data in the workflow, I can only get information for the “most recently updated”, “first created”, “most recently created” etc. I can’t get ALL associated like I can with contacts.

Am I doing this incorrectly, and is there a way to get ALL associated Line items, or will this need to be done with custom code/API work with the help of a developer?

Thanks in advance.

Hi @Nathanhobbs! I understand your goal is to use a webhook to request information on all line items associated with a deal. I want to invite some subject matter experts to see if they have any suggestions.

Hey @JWingate2, @louischausse, @MatthiasKunz, @PMcConnell do you know if this can be achieved in a custom-coded workflow action?

Best,

Kennedy

Hello @Nathanhobbs , @kennedyp
in a custom code, this should be very doable, yes. I do not think it can be done without custom code in a Hubspot Workflow. Alternative would be to simply send the Deal ID in the webhook and then have whatever target platform call the information via an API call by getting the deal. Could be done easily in make or N8N .
Digital Regards,
Matthias

Hi Matthias,

Thanks for the swift response. Would it be possible to make the call through Zapier?

Thanks.

Hi @Nathanhobbs,

It’s possible with Zapier using the “Search Line Items” module and inputting the deal ID.

However, for each line item, you’ll need to perform a “Get Line Item” action to retrieve the properties you need.

Even though I agree that Make or n8n is more suitable, this will still work with Zapier.

The rest of the automation depends on the API call you’re making afterward. If you need to send all the information to the API at once, you’ll have to aggregate your results; otherwise, a unitary send for each item will be enough. :slightly_smiling_face:

Regards,

Marco
Tech Lead @ Mi4

Hi @MarcoMartincic a bit late, but is it possible to create a checkout session in Zapier after getting the items and customer email?

Thanks in Advance!

Hi @SCanales5 and thanks for reaching out to the HubSpot Community!
I’d love to put you in touch with our Top Experts: Hi @Anton, @SteveHTM and @Mike_Eastwood do you have suggestions to help @SCanales5, please?
Thanks so much and have a brilliant day!
Bérangère

Hi @SCanales5, I hope that you are well!
To include associated line items in a workflow custom code action, here’s a friendly approach you can follow:

First, use the Associations API to find the line item IDs linked to your enrolled record, whether it’s a deal, quote, invoice, or another object.
Next, use the line items batch read endpoint to get all the details you need for those items.
Here’s a quick example to guide you:

// Retrieve associated line item IDs
GET /crm/v3/objects/{objectType}/{objectId}/associations/line_items

// Then batch retrieve information for those line items
POST /crm/v3/objects/line_items/batch/read
{
“inputs”: [{“id”: “lineItemId1”}, {“id”: “lineItemId2”}],
“properties”: [“name”, “amount”, “quantity”, “price”]
}
If you’re looking to create a checkout session in Zapier after you’ve gathered the items and customer email, the exact method will depend on your payment processor (such as Stripe) and the features offered by Zapier.
And here are some resources for reference:
- Workflows | Custom Code Actions
- CRM API | Line items
Let me know if you have any other questions.
Have a brilliant day! :sun_with_face:
Bérangère
This post was created with the assistance of AI tools

Hi @Nathanhobbs
Zapier should work as well, yes, although the nested datastructure that typically comes with complex arrays like deal-line item structures makes me think it might not be the ideal platform for this. But yes, the call should work just fine.
Cheers