Regarding duplicate data
Hi @charles In our extended project, we want to prevent users from creating duplicate companies (based on the name). Is there any built-in feature or functionality we can use for this?
22 Replies
There's API which returns duplicate records
The dirty hacky way would be to use webhooks only for creating companies as a trigger in n8n or any other workflow maker, then send request to API for duplicate companies, if there are any, delete them
Which isn't ideal considering the fact that page isn't refreshed unless user does it, login token expires or something happens with cache
@bob Can you provide more detail how can i create the webhook for the duplicate companies cause
Go to Settings, toggle Advanced switch at the bottom of the page, go to API & Webhooks tab, create new webhook by providing URL to which Twenty will send webhooks and settings should be like this
This webhook is then set as a trigger to whole workflow mentioned above
will it trigger for duplicate ? should i add specific endpoint like /duplicate..
It will trigger every time new company is created
Okay! I want to restrict the creating with same company name
Technically you can't with actual features of Twenty
Maybe there's a hidden feature which resolves your problem that I'm not aware
That's why I proposed solution with n8n workflow
But if you really want to prohibit users from creating companies with the same name, you can do it by directly modifying database and adding unique constraint on column name with this query
alter table {your_workspace}.company add unique name;
(remember to replace {your_workspace} with table of your actual workspace)I checked and this works but:
- errors are vague as they're not properly handled (which is expected)
- migration may not work (I'm not sure about that, maybe it'll work but I don't know)
Got it! Thanks @ɃØĦɆᵾS
@ɃØĦɆᵾS I have tried but it's not working!
Could you explain exactly why it isn't working?
I have added constrain on name column but while adding company it's not showing proper error message it's only showing internal server error @ɃØĦɆᵾS
Which version on Twenty do you use?
Also, pings don't work if you add them while editing message
30
0.30.0?
0.30.2
🤔
I tested it on 0.40.0-canary so maybe that's the reason you get the error
I guess if you updated to higher version, this problem wouldn't occur
Any other way available on 0.30.2 Version @bob
That's the only way I'm aware of sadly
@bob slightly of topic, but have you seen any features for merging a People or Companies? This is part of Twenty that's growing to become annoying.
Nowadays I haven't seen such request, there's a discussion about that but no progress on this so far https://github.com/twentyhq/twenty/discussions/5244
GitHub
Merge duplicates · twentyhq twenty · Discussion #5244
We've got a basic feature to surface duplicates but we should build more around it: button to merge duplicates, edit duplicate match criteria...
Ah yes, I commented on that one. I tried to come up with a hack using the deletedAt column but it didn't work. I'll have to try that again.
Thanks, @bob