1

hi m getting the error while in one video the same code is working fine

****Error: Compile Error: expecting an equals sign, found '1' at line 2 column 14****

trigger HelloWorld on Lead (before update) {
    for (Lead 1 = Trigger.new) {
    1.FirstName = 'Hello';
    1.LAstName  = 'World';
   }
}
5
  • 1
    In video i'm sure it is not 1(one) it is l(L). :D
    – Mr.Frodo
    Commented Jul 8, 2016 at 5:33
  • thanks that worked but NOW NEW ERROR SHOWING expecting a semi-colon, found ')' at line 2 column 29 Commented Jul 8, 2016 at 5:36
  • 1
    Lead 1 = Trigger.new this should be Lead l : Trigger.new like something
    – Ratan Paul
    Commented Jul 8, 2016 at 5:37
  • The other error is that you should have a colon where there is an equals sign in the for loop declaration.
    – martin
    Commented Jul 8, 2016 at 5:37
  • Slightly off-topic but related: I blogged about a good font for programming the other day, maybe check it out to avoid these kinds of mishaps (I know you can't change the video): laceysnr.com/on-fonts-for-programming
    – Matt Lacey
    Commented Jul 8, 2016 at 5:45

2 Answers 2

4

couple of errors here

trigger HelloWorld on Lead (before update) {
    //here this should colon not equal in loop 
    // don't use integer here instead use l as variable 
    for (Lead l : Trigger.new) {
    l.FirstName = 'Hello';
    l.LAstName  = 'World';
   }
}
3
  • thanks it worked as a new in coding so was doing some mistakes Commented Jul 8, 2016 at 5:41
  • @MUHAMMADYOUSAFAWAN no issue. everyone start from scratch.. good luck for learning .
    – Ratan Paul
    Commented Jul 8, 2016 at 5:42
  • @MUHAMMADYOUSAFAWAN just for FYI in this community if any answer solved your issue then we accept that answer as best. if my answer worked for you please accept the answer so other can identify this is best answer and it is resolved.
    – Ratan Paul
    Commented Jul 8, 2016 at 5:43
2

Every programming language has its own set of rules and conventions for the kinds of names that you're allowed to use.

I was trying to find out any Salesforce document which provides information about naming convention but i didn't find one.But it is said that they are similar like JAVA.So adding information about naming convention from Java docs.

  1. A variable’s name can be any legal identifier.

  2. It can contain Unicode letter,Digits and Two Special Characters such as Underscore and dollar Sign.

  3. Length of Variable name can be any number.
  4. Its necessary to use Alphabet at the start (however we can use underscore , but do not use it )
  5. Some auto generated variables may contain ‘$‘ sign. But try to avoid using Dollar Sign.
  6. White space is not permitted.
  7. Special Characters are not allowed.

and finally

  1. Digit at start is not allowed.

Documentation

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .