You need to sign in to do that
Don't have an account?
Bhatia
Trigger for capitalizing the first letter of first name and last name on contacts
how can i write a trigger to change the first letter capital for existing first name and last name on the Contact standard object.
Any help will be appreicable.
Thanks
Hi,
If you want to do this for newly created or updated contact record then your trigger is
For existing record just write batch class and update contacts in batch, that update will fire this trigger and there anme will also get set like this.
All Answers
Hi,
If you want to do this for newly created or updated contact record then your trigger is
For existing record just write batch class and update contacts in batch, that update will fire this trigger and there anme will also get set like this.
Thanks Shashank it works.
You are really working for the salesforce, For existing records what i was mainly required.
Finally i have built it what it was desired.
Thanks a lot shashank again to you for guiding me to achieve the goal.
Keep doing it.
Very much thanks to you.
Just fyi, I find it always useful to think about filtering the records that your trigger is going to run on. After all, simple IF statements are cheap, substrings and unnecessary updates are expensive. It's even more important when your trigger would have some more expensive database operations for each record. And it's just a good practice.
Best, Steve.
Hi Steave,
I understand your point that triggers should always execute after checking the entry criteria, I have written this on my blog as well. http://forceschool.blogspot.com/2011/05/writing-apex-trigger-issues-and.html
But here one of the demand was also for doing this for existing records. Thats why I did not put any entry criteria here. I know even existing records handling from batch can also be handled using a static variable, but I thought to keep it simple right now.
Thanks Steve and Shaishank both for giving such useful tips .
I recently had the same problem but it was more complicated as I had to also support dash character. In this link you can find described solution for this problem:
http://blog.enxoo.com/en/2013/06/automatically-capitalize-name-first-letters/
@tukasz What was the issue with the Dash character? I have some records where the name is missing and replaced with a dash character so now you have me concerned ;-) But your link was not working,
Thanks!