Line_items ordering troubles

Hi!

I want to save order of line_items in deal when i get deal details from API

I found ‘hs_position_on_quote’ property with ordering position and this solutions works fine, but a found some deals where this property in line_items returns ‘null’

hmm.. can i use this property for save ordering and in what reasons this property can be “null”?

Thanks!

@himanshurauthan , have you messed around with this problem before?

Hello @Garikk,

Are you fetching the line items after creating the quote or without creating the quote?

While working on quote templates I used this hs_position_on_quote property as shorting and this always works perfectly for me but haven’t tried with API and without creating the quote.

Please share your use case a bit and I will try with different API options.

Regards,

Hi @himanshurauthan

I’m using this flow:

0) i have deal_id

1) get deal - line_item associations using “/crm/v3/objects/deals/{deal_id}/associations/line_item”

2) get products with id’s from (1) using “/crm/v3/objects/line_items/batch/read” with property ‘hs_position_on_quote’

3) sort results by ‘hs_position_on_quote’ property and send result to my system

i cant reproduce situation when this property is null, but some my customers have this problems (i see it in logs)

p.s. if my customer change products order in deal and save it, problem with ‘null’ is gone, i think it looks as a bug

Thanks!

Hello @Garikk,

I shared your query with my team and found the pattern the field ‘hs_position_on_quote’ is null if you haven’t created a quote for the deal.

If you create a quote and have items arranged there then this will work fine.

And I think we can submit this idea to let this ‘hs_position_on_quote’ be set up on the line items for adding/updating on deals itself or have similar fields for ‘hs_position_on_deal’

Hope this helps!

Regards,

Thanks @himanshurauthan

Thank you for explanation, but my clients is create deals with unarranged elements and currently they rearrange items in every deal (after it created) as workaround this problem

Solution with ‘hs_position_on_deal’ or pre-setup hs_position_on_quote on creating deal with unarranged items will be great

Thank you for help!

That’s great @Garikk I’m glad you found the desired solution for your clients.

Hey! can you mark my replies as a solution? :worried:

Happy holidays!!! :christmas_tree: