+ Start a Discussion

Is it a good idea to use SOQL to limit records by Account id of logged in user?

Our org currently has "public read" permissions on our org wide defaults. We cannot make this private.

I am creating a customer portal with custom visual force pages...where I display data using SOQL queries.


Is it a good idea to add a clause on the SOQL query to return only those records where the account id matches the logged in user's acount id?


And if yes..how can I get the currently logged in user's acount id?






Create formula field in User Object. Formula is Contact.Account.Id. Then query that field.


Hi SfRaj..Thanks for replying. I did solve the problem of getting the account id...


But I wanted to see if my approach is correct...i.e the original question of whether using SOQl to limit record accessby account id is a good idea.