You need to sign in to do that
Don't have an account?
bhau
Conditional Autonumber based on Record Type
Hello all,
I checked out the forums and I can't seem to find a solution to this. On person accounts (in Enterprise Edition), I have an auto-number field but I only want increment for my "customers" record type and not my "employee" record type. Right now it is auto-numbering for both even though I want it to increment when it's the customer record type. Can someone help me with this/point me into the right direction or have some custom code that can do this?
Thanks much!
-Billy
You could write a trigger that would update a field based upon the type of record it is. You could also have 2 seperate fields then sum them together in order to get an overall count....
On average, how long would it take to write this trigger?
Thanks!
Without involving Triggers, what do you think of this: have an autonumber field that will give everybody an unique number. Call it Autonumber__c. Then have a second formula text field, called Customer_Number__c. Here's the formula for this field:
IF(
$RecordType.Name = "Customer",
Autonumber__c,
null)
Then the field will be blank unless it's a customer, in which case you will see the autonumber. This is a lot easier than writing a Trigger. Let me know if you don't think that'll work.
Jeremy
Did this solution work for you? I'd be interested in using it if so.
Many thanks,
Dan
I see what Jeremy is getting at here; the customer number would only be populated on customers, but I expect it would not increment properly, as the first autonumber field would continue to increment on employees, as well?
https://salesforcesidekick.com/2016/03/28/how-to-create-a-conditional-auto-number/
Hope this helps those who come looking in the future.