• Sagar Parmar
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies

trigger AccountCreateTrigger on Account (before insert, before update) {
for (Account acc: Trigger.new)
     {Account [] accs = [SELECT Name FROM Account WHERE Name = :acc.Name LIMIT 1];
      if (accs.size() > 0 ) //if account already exists, block and show the information on the page
         {acc.addError('Account  \'' + accs[0].Name +  '\' already exists. Please use existing account or contact your Salesforce Administrator for assistance.'); }
     }
}

 

This has the feel of an easy code but being new to visualforce and apex, I can't seem to figure out how to get past this error. Hope you can help, thanks!

  • October 16, 2013
  • Like
  • 0

One can not split string on '.' character?

 

 

Following code does not work.

String strTest = 'test.test';
String[] arrTest = strTest.split('.');