T
Twenty2mo ago
anjali

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
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
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
anjali
anjaliOP2mo ago
@bob Can you provide more detail how can i create the webhook for the duplicate companies cause
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
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
No description
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
This webhook is then set as a trigger to whole workflow mentioned above
anjali
anjaliOP2mo ago
will it trigger for duplicate ? should i add specific endpoint like /duplicate..
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
It will trigger every time new company is created
anjali
anjaliOP2mo ago
Okay! I want to restrict the creating with same company name
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
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)
ɃØĦɆᵾS
ɃØĦɆᵾS2mo ago
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)
No description
anjali
anjaliOP4w ago
Got it! Thanks @ɃØĦɆᵾS @ɃØĦɆᵾS I have tried but it's not working!
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
Could you explain exactly why it isn't working?
anjali
anjaliOP4w ago
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
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
Which version on Twenty do you use? Also, pings don't work if you add them while editing message
anjali
anjaliOP4w ago
30
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
0.30.0?
anjali
anjaliOP4w ago
0.30.2
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
🤔 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
anjali
anjaliOP4w ago
Any other way available on 0.30.2 Version @bob
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
That's the only way I'm aware of sadly
Raph
Raph4w ago
@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.
ɃØĦɆᵾS
ɃØĦɆᵾS4w ago
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...
Raph
Raph4w ago
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

Did you find this page helpful?