You need to sign in to do that
Don't have an account?
Cassandra Lawson
Trigger to auto assign field value
How do I create a trigger and trigger handler to auto assign a name for custom field on a custom object when a new record is created? The auto-assigned name should be randomly selected from a list of strings.
The code is here. Please use and let me know if not works. Replace contact object with a custom object.
Now the following trigger will pick up the nicknames from the custom setting sort them and randomize them and select one cute nickname every time when your Cats__c will give birth to a new cute kitten.