I’m trying to run upserts on companies via the power automate HTTP step.
I’m pretty sure the company domain is the unique id field for this object, unless I’m wrong. I’m pretty sure I’ve successfully run a power automate flow that uses domain as the unique id.
Anyway, when looking at the domain field settings, the unique id box is unticked. No one has touched anything as it’s a grayed out field that’s generated by hubspot.
Is there any way to change this back? When I run flows I get this error:
Action ‘HTTP’ failed: Unable to perform update/upsert by non-unique 0-2 property domain in portal ID xxxxxxx
I was hoping domain would work as the id as I’m running a dax query to get data from PBI (which is getting data from SAP) to upload to hubspot, so the hubspot record id field won’t be of use.
Any thoughts welcome
Hey @JCarter8,
Yes, as I recall the company domain name used to be the unique identifier for the company record but it appears that it is no longer the case. That default property for the domain even allows for multiple domains to be entered.
To answer your question, there is currently no way to update the default property for the domain to have “require unique values” as true.
While not ideal, what you could do is create a custom property for the domain name and set that to require unique values, then have a wokflow running that populates that field based on value that is in the default property for the company domain name. This would allow you to use this custom property as the unique id for upserts.
Hope this helps!
@JCarter8 - My experience suggests that the logic around domain uniqueness on Company records is somewhat esoteric. There has never, as far as I am aware, been a ‘uniqueness’ rule applied to this field in practice - it’s always been possible to end up with Company records with identical domains in certain circumstances. While import actions try and enforce uniqueness, the API and other functions do not. As shown by your experience with Upsert - the rigorous definition of a unique value is not met by this property definition.
As remarked by @evaldas - adding your own custom property that is properly defined as having unique values is at least one response, buy that can be awkward within the UI.
Steve
@SteveHTM - “esoteric” is a good way to put it. Even now the API documentation states that the “domain” property is used as the “primary unique identifier to avoid duplicate companies in HubSpot” but that does not seem to be the case as I am able to create multiple companies with the same domain via the API.