T
Twenty11mo ago
Noam

Creating unique id's for entries?

Is it possible to create a unique id (Auto generated/ Incremented) for entries? For example a customers will have a unique ID for identification (Ex: 1000151, 1000228). Meaning I will be able to quickly find customer just by typing his unique id. Couldn't find a way to do so 😞 would appreciate any help or suggestions 🙂
17 Replies
ɃØĦɆᵾS
ɃØĦɆᵾS11mo ago
You can create field with type Unique ID To do this, you have to go to Settings > Data model > object to which you want to add a field > click New field button > select Unique ID type > fill name and create
Noam
NoamOP11mo ago
I tried that. But it doesn't look like it does something.
No description
No description
ɃØĦɆᵾS
ɃØĦɆᵾS11mo ago
That's not true It does something aka it exists 😄 Let me check this because maybe it's not available on UI side but only on API
Noam
NoamOP11mo ago
I think so.. I also guess the results from this would be a very long string? (00000-0000-0000)
ɃØĦɆᵾS
ɃØĦɆᵾS11mo ago
So from what I've checked: - Unique ID field (I'll refer to this as UUID) is not available in UI but only with API - records with UUID by default have null so if you want to have a record with UUID, you'll have to update it using API But since you want a UUID for records, default ID will do the work as it's UUID (which is obtainable only by API)
Noam
NoamOP11mo ago
Umm thats bad 😓 Do you think maybe in a future releases? Working with the default ID would work, but its a bit of a shame to give customers a customer number of 45... 😅 Maybe there is an hidden option to make a Unique text? Meaning I will manually write the value but no other rows will be able to have this value?
ɃØĦɆᵾS
ɃØĦɆᵾS11mo ago
Do customers have to know which number they are? Also, are you creating all records by hand without any automation?
Noam
NoamOP11mo ago
I'm experimenting CRM softwares and Twenty caught my eye for its simplicity (UI). Main goal is to open a small crm software to track and manage customers from their contact details to their inquiries etc.. I never built a crm software (New business) but do have experience working on one from the past company I worked at (Each customer had uinique id which looked like 10003115) and I'm triyng to make things similar and keep the simplicity of both the UI and data structure. I think for technical reasons and to make things easier between the relationship with the customer, to have a custom number which will make things easier when giving it for example over a phone call.. So no, no automations. Although its important to have the option to make automations for the future.
ɃØĦɆᵾS
ɃØĦɆᵾS11mo ago
I see, I was asking whether you use automations or not as it's possible to do it using n8n/Make/Windmill Sadly, such feature where field is automatically incremented doesn't exist in Twenty but if you use code, you can do it easily And when using workflow automation tool like mentioned, you can easily automate contacting to your customers If you want, you can always request such feature on Github but I can't say when it'll be done
Noam
NoamOP11mo ago
Yeah, it’s worth the shot. I guess things have changed as from my research for a tool, most if all the open source crm’s does not have such feature. Do you have a scenario for such automation? Meaning do users typically open the customers using third party tool or app?
ɃØĦɆᵾS
ɃØĦɆᵾS11mo ago
Yes, more advanced users use third party tools for customers, whether it's a contacting them with Twilio, transcribing calls, inserting notes about specific customer, etc.
Noam
NoamOP11mo ago
That’s interesting. I will check that out. Thanks for the help!
ɃØĦɆᵾS
ɃØĦɆᵾS11mo ago
No problem
lh_magic
lh_magic4mo ago
While my need is not incremental values like discussed above, I wanted to use it to keep a few other apps in sync by using a hashed value of phone or email or url as a unique identifier. It removes the requirement to ever check if a new company etc exists elsewhere. Because its hashed it ensures, there is no need to ever pass the actual value for data privacy. Don't need much else except to make it visible in the UI.
lh_magic
lh_magic4mo ago
Saw a discussion here but not sure if it went anywhere: https://github.com/twentyhq/twenty/issues/10746
GitHub
view object ID · Issue #10746 · twentyhq/twenty
Scope & Context We are working on improving the data transparency and traceability in Twenty CRM. The ticket is about making object unique IDs visible as fields on the respective object deta...
Prastoin
Prastoin3mo ago
Hey @lh_magic, from my understanding you wanna add a custom validation abstraction to a field metadata. Unfortunately this does not exist for the moment the only native field metadata that has the uniquess validation ( by defintion ) is the id as it uses uuids A workaround for you could be to create a workflow that will listen to each records addition and search through existing one for a match ( you could even implement the hash signature you've been describing in a dedicated column ) Asked for validation to our producent team, but unless I'm mistaken we're planning on adding such custom validation starting of Q1 2026 https://github.com/twentyhq/core-team-issues/issues/813
Noam
NoamOP2mo ago
A follow up, I managed to find a solution using workflows. I created a task: 1. When a record created 2. Run a code 3. Update desired record (Customer ID) with the output. The code I've inserted converts the unique UUID provided by twenty and coverts it into 9 numeric string using hash. This makes the customer id generation unique based on the UUID. Would be much better if Twenty would add a formula entry and a way to tick unique fields. The code:
import { createHash } from 'crypto';

export const main = async (params: { a: string; b: number }): Promise<object> => {
const { a } = params;
const hash = createHash('sha256').update(a).digest('hex');

const hexSlice = hash.slice(0, 10);
const bigInt = BigInt('0x' + hexSlice);

const MIN = 100000000n;
const MAX = 999999999n;
const range = MAX - MIN;

const numericId = (bigInt % range) + MIN;
return { customerId: numericId.toString() };
};
import { createHash } from 'crypto';

export const main = async (params: { a: string; b: number }): Promise<object> => {
const { a } = params;
const hash = createHash('sha256').update(a).digest('hex');

const hexSlice = hash.slice(0, 10);
const bigInt = BigInt('0x' + hexSlice);

const MIN = 100000000n;
const MAX = 999999999n;
const range = MAX - MIN;

const numericId = (bigInt % range) + MIN;
return { customerId: numericId.toString() };
};

Did you find this page helpful?