function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
larrmill59larrmill59 

How to include Account name in an Auto-Number field

I have a custom detail object where account is the master object. I've set up the Name field of the custom object as an auto number to get some consistency. I originally had just a date and number. Now I want to to have the following:

 

account name - {mm} - {yyyy} - {0} with the account name automatically filling in.

 

Does anyone know how to do this?

Steve :-/Steve :-/

Okay for that you're gonna have to change the datatype of the Field from Auto-Number to Text.  Then create a a separate Auto-Number Field, and a WorkflowRule with a Field Update Workflow Action that will update the custom detail object Name (Text) field with theformula

 

Account__r.Name + "-"+  TEXT(MONTH(DATEVALUE(CreatedDate)))  + "-"+  TEXT(YEAR(DATEVALUE(CreatedDate))) + "-"+   Auto_Number__c

 or you could simplify things and change the Format of the Auto-Number field to

 

 

{MM}-{YYYY}-{000000} 

 and then you Workflow Rule Field Update would just be

 

Account__r.Name + "-"+ Auto_Number__c

 

 

 

 

 

Steve :-/Steve :-/

Are you all set now, or do you still need help with anything?

larrmill59larrmill59

Steve:

 

Your solution does work technically. The issue is that I don't want our salespeople to have to fuss over what to name this record, and when you change the Name field to a text format, it requires the user to enter something, which would then be overwritten by the workflow field update above.

 

In addition, when they go back later they won't be able to find the record under the name they entered because it was changed by the workflow.

 

If I could even enter a default value that would then be changed by the field update, that would work but the Name field doesn't give you that option.

 

So no I don't yet have a good solution, although yours is the best so far.

 

Thanks,

Larry

 

 

Steve :-/Steve :-/

Unfortunately you may need to address that through Validation Formulas and User Training.  

 

"So no I don't yet have a good solution, although yours is the best so far."  -  It's only the best because of your sample size ;-)