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
Atul Shendge 2Atul Shendge 2 

Account data is held all in capital letters.

Hi All,

Hope you all are safe!

I have a requirement, when a user tries create a Account and when user enter a First Name and Last Name, In this case, If user enters all letter of FirstName and LastName as capital or small, Upon saving user should see first letter of FirstName as capital same goes with LastName as well.

For e.g.
If user enter like JOHN ADAM, It should display John Adam.

Thanks in Advance,
 
VinayVinay (Salesforce Developers) 
Hi Atul,

You can acheive this by using workflow rule and field update.  Check example below.

https://trailblazers.salesforce.com/answers?id=90630000000hNUHAA2

If you do not want to use workflow then you would need to implement custom logic below is the example.

https://developer.salesforce.com/forums/?id=906F00000008xAiIAI

Also check Appexchange tool below.
https://appexchange.salesforce.com/listingDetail?listingId=a0N3000000B5YhNEAV

Hope above information was helpful.

Please mark as Best Answer so that it can help others in the future.

Thanks,
Suraj Tripathi 47Suraj Tripathi 47
Hi Atul,
You can take reference from this below code.
trigger AccountNameUpdate on Account (after insert) {
    List<account> accList=[select name from account where id IN: trigger.new];
    for(account acc: accList){
        string[] names= acc.name.split(',');
        for (Integer i = 0; i < names.size(); i++){
            names[i] = names[i].capitalize();
        }
        acc.name = String.join(names, ' ');
    }
    if(accList.size()>0){
        update accList;
    }
}

In case you find any other issue please mention. 
If you find your Solution then mark this as the best answer. 
CharuDuttCharuDutt
Hii Atul Shendge
Try Below Trigger
trigger NameCapitalize on Account (before insert ,before update) {
    string[] ACCname;
    if (Trigger.isBefore  && (Trigger.isInsert || Trigger.IsUpdate)) {
    for(account acc: trigger.new){
        ACCname = acc.name.split(' ');
        for (Integer i = 0; i < ACCname.size(); i++){
            ACCname[i] = ACCname[i].capitalize();
        }

        
        acc.name = String.join(ACCname, ' ');
    }

    }

}
Please Mark It As Best Answer If It Helps
Thank You!