Hi @Taghreeddb_96,
You could achieve this by using the hardcoded text + year + number based on the amount of records with that initial prefix (CRR-ZTT-2023).
On the OnVisible of the screen save the first part of the code (without the number) to a variable:
Set(
varStartCode,
$"CRR-ZTT-{Year(Now())}"
)
The Default property of the text field (DataCardValue control) would have the following code:
if(
EditForm1.Mode = FormMode.New,
//Change Listname and CodeColumn to the correct values
$"{varStartCode}-{Text(CountRows(Filter(LISTNAME,StartsWith(CODECOLUMN, varStartCode))),"0000")}",
Parent. Default
)
Please do keep in mind that CountRows() cannot return a number higher than 2000 - so the string will be unique up to 2000 records with the 'CRR-ZTT-2023' as first part of their unique code.
If this solves your question, would you be so kind as to accept it as a solution.
Thanks!