Auto-generate HubSpot quote with dynamic number of line items

Hi! I have recently created a pipeline that allows me to create Line Items from user form fields, and associates them with a Deal in HubSpot. The Line Items are dynamic and different Line Items will be created for each Deal, and it is likely a different number of Line Items each time.

When I create a Quote, I have to associate the Quote to the Deal. I also have to associate the Quote to the Line Items. The issue is, in the Create a Quote Module, I would have to specify the number of fields that go to specific Line Item IDs, and this will change on each run - OR I would have to map the fields which I have done in the picture. Ideally, I want to pass an array of Line Item IDs to the Create Quote Module so that all of them are associated with the Quote at the same time, as well as the Deal ID (2. in this case). The Line Items with this mapping don’t show all Line Items and throw an error.

Thanks for any suggestions or help on this!

1 Like

Hi @hubs,

This is a common dilemma developers come across in Make. Instead of all line items being added at once, what’s required is iterating on the line items and with each iteration you will “Update the Quote”.

So add an Iterator that iterates on the Deal Line Items. The iterator will know how many line items there are.

Hope this helps!

-@Trainward_Consulting

1 Like

I appreciate the help! I ended up doing the following:

I ended up iterating over the line items as you said - had to do this regardless, to dynamically choose my line items from a list. For each selected line item, I created a JSON block (I used another iterator for this, but you probably don’t have to). Then, I aggregated the JSON blocks using a Text aggregator module, and created the quote using an HTTP request module instead with the big block of JSON text for my Line Items.

2 Likes

Wonderful to hear! Glad you were able to create the solution and pick up on the complexities of iterating!

-@Trainward_Consulting