You need to sign in to do that
Don't have an account?
sai.sf
sforce.connection.query
Hi All,
sforce.connection.query('Select Name,Id from Account where Name=xyz') returns only records that are accesseble to user in button.So the query returns not same results to all users.how to retreive all records from the query?
Thanks
Sai.sf,
Read this post - this describes exactly what you are trying to do:
http://boards.developerforce.com/t5/Apex-Code-Development/sforce-connection-queryAll-quot-SELECT-Id-Name-FROM-Account-quot/td-p/320893
-Andy
All Answers
What do you mean by "records that are accesseble to user in button"?
If you look at the SOAP documentaton for the query() method, it clearly states that:
Check out the Factors that Affect Data Access.
Hope this helps!
- Anup
This is a result of Sharing Rules in your org. To bypass sharing rules, remove the "with sharing" keyword from your APEX class definition.
Also - make sure that is REALLY what you want to do, Sharing Rules are typically there for a reason!
-Andy
Hi Andy,
I suspect that "with sharing" will solve his problem. He doesn't state it explicitly but "sforce.connection.query" indicates that the request is made via the webservice somewhere in a client application.
- Anup
i am using webservice class.I am not using ' with sharing' keyword in my class .I don't know why i am getting soql results different per user?
Hi Sai.sf,
Like I said look at the link that I've provided in my reply. Go through that list, and eliminate each possibility one by one. It is most probably down to field permissions, and roles.
- Anup
Sai.sf,
Read this post - this describes exactly what you are trying to do:
http://boards.developerforce.com/t5/Apex-Code-Development/sforce-connection-queryAll-quot-SELECT-Id-Name-FROM-Account-quot/td-p/320893
-Andy
Thanks Andy & Anoop for your valuable inputs that helped in fixing the error.