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.
Note : You should never create classes with the names which are already being used by the platform.