You need to sign in to do that
Don't have an account?
rohan patel 30
How to increment a text field by 1 after record creation.
Hello,
I have a simple use case.
I need to update a text field "Contact id" after increment it by 1 whenever a new contact is created.
below is ss for reference. I want to update contact id as 172 for new contact creation.
Please help me how can I update a text field by 1 .
field label : contact id
api name :Contact_ids__c
I have a simple use case.
I need to update a text field "Contact id" after increment it by 1 whenever a new contact is created.
below is ss for reference. I want to update contact id as 172 for new contact creation.
Please help me how can I update a text field by 1 .
field label : contact id
api name :Contact_ids__c
I am very critical of design solutions and before providing any answer, would try to understand the requirement.
Is this field to know how many total contacts you have in the system and does this field represents the number for example you may have contact created before with the number 170, 169, 168, etc?
What if any contact got deleted, you may lose the sequence and this information may not give you the right picture?
.If you can provide a little more context.
I just need this field for a unique contact id for each record. 170 is highest number currently and I want to increment it like 171,172 and so on.
this field does not represent number of contact so losing sequence won't be an issue.
So assuming this field exists on Contact SObject. Here is the code
Trigger
Apex Class
Test Class