You need to sign in to do that
Don't have an account?
Carolin Heyn
Custom Name Scheming for Cases
Hello everyone,
We would like to have a custom naming scheme for our cases based on the account and also based on the year of creation. So the account and the created year is easy to get. But we also want to have an automatic number on the account, which will be reset at the beginning of a new year. So that means e.g. the case for the ACME account should be given a name based on this ACME-2019-0001 and in 2020 it should look like this ACME-2020-001.
Any ideas on how to get this scheme with Apex Trigger?
Many thanks
We would like to have a custom naming scheme for our cases based on the account and also based on the year of creation. So the account and the created year is easy to get. But we also want to have an automatic number on the account, which will be reset at the beginning of a new year. So that means e.g. the case for the ACME account should be given a name based on this ACME-2019-0001 and in 2020 it should look like this ACME-2020-001.
Any ideas on how to get this scheme with Apex Trigger?
Many thanks
Hope you doing good.
I think you can achieve this with simple formula fields.
Create a formula field of return type text on Account object with label as as Year give below formula
Then in case object, create a formula field of return type text and update below formula.
I assumed that you will take first 4 letters from account name, just change 4 to whatever count of letters that you want to take from account name, CaseNumber is a auto number field and is standard field.
Hope it helps, marks it as best if it really helps you.
Nut only with the Case Number I got no ongoing Number based on Account and Yaer.
Because if I have a second customer e.g ACME2 I want to have the Name start with ACME 2 - 2019-001.
Hope you understand what I mean.
BR Carolin
Yes, I got it now😂😂, you need to write a trigger to get it done.
Before going to trigger, you need to create two things first.
1) Create a custom label with name "Auto Number" and give value = 0
2) Create a custom number field on Case object with label as "Auto Number"
once you do those two then create an apex class with name "AutoNumberonCase" and copy paste below code to your class.
then create a trigger on case object, copy paste below code.
then create a formula field on case object with return type as text and have below code in formula field.
Mark it best if it solves your problem.
Hope it solves your problem