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
Trif Cristian 7Trif Cristian 7 

Trigger Error Variable

Hello, i have a simple trigger:


trigger TriggerA on Account (before insert) {
    for(Account a : Trigger.new){
      if(a.Description == NULL)
         a.addError('You must add a value');
    }
}

Error: Compile Error: Variable does not exist: Description at line 3 column 12. I don't understand why.
Best Answer chosen by Trif Cristian 7
sfdcMonkey.comsfdcMonkey.com
Hey Trif Cristian,

 your trigger is perfect, problem is with your description field level security on account object :

open description field from account object and click on Field-Level Security button

User-added image

make sure your profile have read access to all fields which you want to use in your code

User-added image

Hopes it will helps you
kindly let us know if it helps you
Thanks

All Answers

Ramesh y 10Ramesh y 10
looks like you don't have an access to Description field on Account. check field level security, you must have read access.
sfdcMonkey.comsfdcMonkey.com
Hey Trif Cristian,

 your trigger is perfect, problem is with your description field level security on account object :

open description field from account object and click on Field-Level Security button

User-added image

make sure your profile have read access to all fields which you want to use in your code

User-added image

Hopes it will helps you
kindly let us know if it helps you
Thanks
This was selected as the best answer
Trif Cristian 7Trif Cristian 7

Worked like a charm. Thank you guys! ^_^