We use cookies to make HubSpot's community a better place. Cookies help to provide a more personalized experience and relevant advertising for you, and web analytics for us. To learn more, and to see a full list of cookies we use, check out our Cookie Policy (baked goods not included).
Apr 15, 2021 12:43 PM
Hi, I'm looking to get the latest deal for a contact, if I use crmAssociations to get the deal ids for a contact can I assume that the largest deal id is the latest? Or is there another way I should go about this? Thanks!
Solved! Go to Solution.
Apr 16, 2021 12:45 PM - edited Apr 16, 2021 12:45 PM
You could gather all of the associated Deal IDs into an array, batch read those deals, then sort through them looking for the most recently updated deal. You can specify different properties to return in order to fit your definition of "latest."
Here are the docs on that in case you're interested in that route /crm/v3/objects/deals/batch/read https://developers.hubspot.com/docs/api/crm/deals
Hope that helps.
Apr 16, 2021 12:45 PM - edited Apr 16, 2021 12:45 PM
You could gather all of the associated Deal IDs into an array, batch read those deals, then sort through them looking for the most recently updated deal. You can specify different properties to return in order to fit your definition of "latest."
Here are the docs on that in case you're interested in that route /crm/v3/objects/deals/batch/read https://developers.hubspot.com/docs/api/crm/deals
Hope that helps.
Apr 16, 2021 11:59 AM
They do generally increment, but I would avoid making assumptions like this.
Might be worth exploring the CRM Search where you can sort. @tominal , what do you think?
![]() | Make sure to subscribe to our YouTube channel where you can find the HubSpot Community Developer Show |