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
Apex-TriggerApex-Trigger 

Apex class error ::Type is not visible: account

Hi ,

      I got a error , Account type is not visible . I checked sharing settings it is fine  , I am working as sys admin , My apex code is correct , I dont know where i gone wrong , Can any one help me ?..

 

Thanks ,

 

Jana

Best Answer chosen by Admin (Salesforce Developers) 
salesforce expertsalesforce expert

this usually happens when you set the class members as private and try to access them out of the class. try making your variable as public and see if it works for you!

 

baskaran

All Answers

salesforce expertsalesforce expert

this usually happens when you set the class members as private and try to access them out of the class. try making your variable as public and see if it works for you!

 

baskaran

This was selected as the best answer
ngabraningabrani

Could you post the trigger code. It will help in understanding the cause of the issue.

Apex-TriggerApex-Trigger

Thanks a lot....My apex class is private ...so that created a problem ...

hemantgarghemantgarg

can you paste the code snip which is hrowing this error?

Apex-TriggerApex-Trigger

Code is Not a problem , Apex Trigger : 

trigger AccountDelete on Account (before delete,before insert,before update,after delete, after insert,after update) {
  
  for(account a : trigger.old)
  {
    if(a.Name!='todelete')
    {
      a.addError('You Dont have access to delete this account');
      }
  }
}

 

Apex Class:

private class account {

static testMethod void myUnitTest() {
// TO DO: implement unit test
}
}....Hence apex class name is Account ....Trigger refers to account , it means account class ,hence the class is private can not be accessed outside ...so it throws an error .

...Error in Trigger :Type is not visible: account .... I solved it by changing account class name as accountcheck ....

hemantgarghemantgarg

Good to know, I experienced the same type of error first time, where I had created an Apex class by Name "Test" , I remember It took me whole of the day  to identify this error :)