# Line\_items ordering troubles

**URL:** <https://community.hubspot.com/t/line-items-ordering-troubles/45883>\
**Category:** APIs & Integrations\
**Tags:** object\
**Created:** [October 25, 2021, 1:55pm UTC](https://community.hubspot.com/t/line-items-ordering-troubles/45883 "2021-10-25T13:55:35Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garikk](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@Garikk](https://community.hubspot.com/u/Garikk)\
**Post date:** [October 25, 2021, 1:55pm UTC](https://community.hubspot.com/t/line-items-ordering-troubles/45883/1 "2021-10-25T13:55:35Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![dennisedson](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/dennisedson/32/28044_2.png) [@dennisedson](https://community.hubspot.com/u/dennisedson)\
**Post date:** [October 26, 2021, 5:21pm UTC](https://community.hubspot.com/t/line-items-ordering-troubles/45883/2 "2021-10-26T17:21:18Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [October 27, 2021, 9:21am UTC](https://community.hubspot.com/t/line-items-ordering-troubles/45883/3 "2021-10-27T09:21:12Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Garikk](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@Garikk](https://community.hubspot.com/u/Garikk)\
**Post date:** [October 27, 2021, 11:03am UTC](https://community.hubspot.com/t/line-items-ordering-troubles/45883/4 "2021-10-27T11:03:38Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [October 29, 2021, 10:59am UTC](https://community.hubspot.com/t/line-items-ordering-troubles/45883/5 "2021-10-29T10:59:51Z")

</div>

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,

---

<div class="post-metadata">

**Author:** ![Garikk](https://avatars.discourse-cdn.com/v4/letter/g/8491ac/32.png) [@Garikk](https://community.hubspot.com/u/Garikk)\
**Post date:** [December 29, 2021, 10:44am UTC](https://community.hubspot.com/t/line-items-ordering-troubles/45883/6 "2021-12-29T10:44:27Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![himanshurauthan](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/himanshurauthan/32/53076_2.png) [@himanshurauthan](https://community.hubspot.com/u/himanshurauthan)\
**Post date:** [December 30, 2021, 5:00am UTC](https://community.hubspot.com/t/line-items-ordering-troubles/45883/7 "2021-12-30T05:00:14Z")

</div>

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

Hey! can you mark my replies as a solution? 😟

Happy holidays!!! 🎄
