You need to sign in to do that
Don't have an account?
shrey.tyagi88@tcs.com
Filter entries in an object based on owner-plz help!!!
Hi,
I have a custom object called Notification__c.Entries are made in this object when a trigger is fired.This object also has a feild Ownerid__c.Now I wanna write a custom page where an owner can see only the records that are owned by him . Can you please tell me how to capture user's info based on their login credentials.I wanr to capture that info and use it in SOQL query like this:
Select * from Notification__c where (ownerid__c = information provided by login credentials of user )
Plz help,it's urgent
Thanks
Use below function get current logged in user ID.
UserInfo.getUserId()
EX:
ID id = UserInfo.getUserId();
list<account> a = [select id from account where ownerid =: id ];
regards
San
All Answers
Use below function get current logged in user ID.
UserInfo.getUserId()
EX:
ID id = UserInfo.getUserId();
list<account> a = [select id from account where ownerid =: id ];
regards
San
Thanks a lot for your help!!!! I have one small query, plz help me with it.
I wanna show records only on basis of their owners. So i wanna compare Owner field of record with info from login credentials, How can we do this? what is the method for this?
I mean for every record that you create in any object ,there is an owner field in that object. I wanna match that field with info that I can fetch from user's login credentials.How can I acheive this?
I have made a mistake in my first post.Ownerid is not a cutom field, its the standard owner feild.
So i wanaa acheive this:
owner=userInfo.get (WHICH METHOD TO USE HERE? ID OR NAME?)
I am not understanding ur req...
Userinfo methods gives you the output related to current users login.
for methods go throgh follwing link:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_userinfo.htm
Regards
San