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
Anitha Reddy 14Anitha Reddy 14 

Write a trigger,When account record is inserted,check(Name=123)..If it contains 123,donot insert..Send error message that account name already exists.

Edwin VijayEdwin Vijay
trigger HelloWorldTrigger on Account (before insert) {
    for(Account a : Trigger.New) {
                  a.addError ('You cannot insert an account with name containing 123');

Hope that helps!
Anitha Reddy 14Anitha Reddy 14
Thank you Edwin. Regards Anitha
Apoorv Saxena 4Apoorv Saxena 4
Hi Anita,

Please try the below code:
trigger checkAccountName on Account (before insert) {    
            acc.addError('Account name already exists.');

Please mark this question solved if this helps you !

Anitha Reddy 14Anitha Reddy 14
Thank You Apoorv.. Regards Anitha