You need to sign in to do that
Don't have an account?
priyanshi
how to display the owner standard field
i have this custom controller and when i try to retrieve the owner field it shows an error.
public class postscontroller {
public list<post__c> getMyposts() {
return [select name,owner,id,subject__c,posted_on__c,category__c from post__c];
}
}
can anyone help me know why i am getting an error?
Hi,
Try the below query as reference:
[select id,subject__c,posted_on__c,category__c,owner.name from post__c]
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
All Answers
Its OwnerId and not Owner.
thanks
but then how can i display the owner name? because owner id field will display the id and not name...
if u use <apex:inputfield vlaue="{!obj.ownerid}"/> it automatically bring the name
or u can fetch the like [select ownerid.name in selesct querty & assing in a stirng property & can use on VF page
Hi,
Try the below query as reference:
[select id,subject__c,posted_on__c,category__c,owner.name from post__c]
Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.
thanks :)