+ Start a Discussion
Chris MarzellaChris Marzella 

How to autopopulate name field using a lookup field

I have this lookup field created, but I cannot save due to the name field being required. How can I work around this? Looks like it may need a apex trigger using before update possibly?
Donald BlayDonald Blay
A record needs a Name (or any required field) before it can be saved, and formula fields are not evaluated until after.
You're best bet might be to save the object with temporary name, and then create a workflow to rename it.
For example: set the object up with a Auto-number name with a format like "Temp-Name-{0000}". Then create a workflow with entry criteria of object.Name starts with "Temp-Name" and then set the name to the value of the formula field.  
@Donald: Auto-Number fields are not writable. You can not update Ato Number fields.

@Chris: You can override your New button with Visualforce page. Then you have the full control and you will be able to populate the Name field.