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
This happens when your organization has a class named as
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.
Compile all your classes post renaming and then try saving your changes.
You can compile all classes by navigating from Setup > Develop > Apex Classes > Click on Compile all classes
Note : You should never create classes with the names which are already being used by the platform.