+ Start a Discussion
MVJMVJ 

How can I run a query to get all data

We are using the private sharing model.  I have a need for my users to be able to query all accounts and see if an account already exists before they create a new one.  Since we have a Private sharing model a general query will onlt return accounts that they have visibility to.

 

My thought is to create a VF page that will search all the accounst and display the matches.  In order to do that I will need to execite the querry with a sysadmin access.  

 

Can this be done?  Can a users submit a query with sysadmin rights so they have visibility to all accounts.

 

Thanks

bob_buzzardbob_buzzard
Custom VisualForce controllers execute entirely in system mode, so you should get what you want by default.  As long as you don't use the "with sharing" keyword in the class definition.