You need to sign in to do that
Don't have an account?

Variable does not exist in Extension Controller
Below is the code sample I'm trying to put in a controller extension class. However, I'm getting "variable does not exist: opp.id" error at line 13. The actual code makes a http callout to an external service. I'm trying to write code to make a javascript remoting call on click of a button from a VF page. Could you please help
Thanks.
public class TestPageEx { private final Opportunity opp; // The extension constructor initializes the private member // variable acct by using the getRecord method from the standard // controller. public TestPageEx(ApexPages.StandardController stdController) { this.opp = (Opportunity)stdController.getRecord(); } @RemoteAction public static String aaExample(String s) { Attachment att= [Select Id,ParentId, Name,body,ContentType From Attachment where ParentId = :opp.Id limit 1]; } }
Thanks.
Only static variables are allowed to access within the static method.
public static Opportunity opp {get;set;}