2

enter image description here Unable to access opportunity object fields in apex classes and in triggers also .even in the standard way of creating apex classes. getting an error as variable doesn't Exist, even field is available. please help me out on this

  • In the future, you should upload your code as text instead of a screenshot. It's easier to copy into an answer & easier to read. – battery.cord Feb 6 at 14:55
  • @battery.cord yaa sure – Akhil Thanneru Feb 7 at 6:59
7

This happens when your organization has a class named as Opportunity.

Check in your list of classes which is named as Opportunity and rename it to something else.

Compiler searches for Amount property in your custom made Opportunity class which if doesn't exist, then it gives an compilation error.

Note : You should never create classes with the names which are already being used by the platform.

  • even after renaming the class unable to access fields – Akhil Thanneru Feb 6 at 10:05
  • 1
    Compile all your classes post renaming and then try saving your trigger changes. You can compile all classes by navigating from Setup > Develop > Apex Classes > Click on Compile all classes – Vijay Ganji Feb 6 at 10:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.