APIs & Integrations

LNail
Member

How to check for updated deal ID

TLDR: Syncing deal data to a merged deal does not result in error, nor does it update the merged deal. How can we program for this?

 

Our customer support team works in HubSpot all day. We sync our application user info to Contacts and their respective businesses to Companies regularly to keep the data consistent. Additionally, we store the Deal ID in our application to easily link from our app to the deal in HS.

 

There are times when an end user may create a new Business and User account within our application, creating duplicates. To correct, we merge the accounts within our application and within HubSpot. 

 

When merging on HubSpot, the result of the merge sometimes changes the Deal ID. When this happens, the link within our application continues to work, forwarding the user to the updated newly-merged deal. 

 

The issue is when we sync our Deal data to the old ID, we do not receive any errors or warnings. However, the data is not updated on the newly-merged Deal.

 

To avoid the errors that manually updating can create, how can we programmatically catch for this change in order to update the correct Deal?

0 Upvotes
4 Replies 4
Mike_Eastwood
Key Advisor | Gold Partner
Key Advisor | Gold Partner

How to check for updated deal ID

Hi @LNail 

 

In the Object (Deal) there is a Property called "hs_merged_object_ids" this will contain any old Object IDs from before the merge.

 

Hopefully this will solve your sync issue (with a bit more code ;o)

 

Have fun

Mike

 

Here to learn more about HubSpot and share my HubSpot Knowledge. I'm the founder of Webalite a HubSpot Partner Agency based in Wellington, New Zealand and the founder of Portal-iQ the world's first automated HubSpot Portal Audit that helps you work smarter with HubSpot.

0 Upvotes
LNail
Member

How to check for updated deal ID

Thanks Mike. That does help.

Does it contain the new object ids, as I will only have the old ID and am looking for the new ID?

0 Upvotes
Mike_Eastwood
Key Advisor | Gold Partner
Key Advisor | Gold Partner

How to check for updated deal ID

Hi @LNail 

 

As far as I know you can't filter on the Merged Deal IDs (I haven't tried with the Search API).

 

What if you took a different approach and added your other system's Deal ID – as a Custom Property – in the HubSpot Deal. Then, even if a Deal is merged you can search the Custom property for the deal you want to update.

 

Would that work?

Mike

0 Upvotes
LNail
Member

How to check for updated deal ID

@Mike_Eastwood that's a great idea but I'm not sure how it would work considering my current circumstance.

 

I already use the Search API and have a secondary issue where I can't seem to return any property that isn't already returned by default.

 

Specifying the properties I want returned, i.e. "hs_merged_ids", results in only three properties being returned.

 

 

$response = $this->request->post(
            "/crm/v3/objects/deals/search",
            [
                "filterGroups" => [
                    [
                        "filters" => [
                            [
                                "value" => $id,
                                "propertyName" => "hs_object_id",
                                "operator" => "EQ"
                            ]
                        ],
                    ],
                ],
                // 'properties' => [ // doesn't work
                //     'hs_merged_ids'
                // ],
                "limit" => '1',
                "after" => '0'
            ]
        );

 

 

Without the properties attribute:

 

[ // Response when not including properties attribute
    [
      "id" => "xxxxxxxxxxxx",
      "properties" => [
        "amount" => null,
        "closedate" => null,
        "createdate" => "2023-06-02T20:10:12.421Z",
        "dealname" => "xxxxxxxxxxxxxxxx",
        "dealstage" => null,
        "hs_lastmodifieddate" => "2023-11-21T21:04:44.734Z",
        "hs_object_id" => "xxxxxxxxxxxxxxxx",
        "pipeline" => null,
      ],
      "createdAt" => "2023-06-02T20:10:12.421Z",
      "updatedAt" => "2023-11-21T21:04:44.734Z",
      "archived" => false,
    ],
  ]

 

 

With the properties attribute (shown commented out in first set of code):

 

[ // Response when including properties attribute
    [
      "id" => "xxxxxxxxxxxxxxxx",
      "properties" => [
        "createdate" => "2023-06-02T20:10:12.421Z",
        "hs_lastmodifieddate" => "2023-11-21T21:04:44.734Z",
        "hs_object_id" => "xxxxxxxxxxxxxxxx",
      ],
      "createdAt" => "2023-06-02T20:10:12.421Z",
      "updatedAt" => "2023-11-21T21:04:44.734Z",
      "archived" => false,
    ],
]

 

 

The above responses are on the new ID assigned to two recently-merged deals. Searching for the old id's of the merged deals returns null on the Search API.  

 

@Mike_Eastwood any suggestions?

0 Upvotes