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

Get the query string value in Remote Action Method
Hi folks,
Can anyone tell me how to get the value of query string in Remote Method?
My code as follows
I get the following error message while running the above code
attempt to de reference a null object
How can I fix this error?
Thanks in advance
Karthick
Can anyone tell me how to get the value of query string in Remote Method?
My code as follows
@RemoteAction global static Contact getContact() { String CID=ApexPages.currentPage().getParameters().get('id'); String ContactId=CID.trim(); contact c= [SELECT Id, FirstName, LastName,Phone FROM Contact WHERE Id= :ContactId]; return c; }
I get the following error message while running the above code
attempt to de reference a null object
How can I fix this error?
Thanks in advance
Karthick
you can't get the querystring parameter inside the @RemoteAction method because remoteaction method is stateless.. But if you want to operate on a specific id then you can pass the id as a paramter from javascript and later receive this in function parameter.
For reference you can use this link:
http://salesforce.stackexchange.com/questions/11215/do-remoteaction-methods-have-access-to-page-parameters
Thanks