+ Start a Discussion
SIVASASNKARSIVASASNKAR 

VISUAL FORCE HOW TO GET Owner FIELD ON VISUAL FORCE PAGE

>>

>>

 I WANT TO DISPLAY MY OWNER FIELD ON VISUAL FORCE FIELD.

 

Example:

 

I HAVE UNIVERSITIES__C CUSTOME OBJECT OWNER IS SIVASANKAR ADMIN

 

 

I'm unable to display my woner field on the visual force page

 

<apex:inputField value=" {!Universities__c.owner} "/>

 

OR

 

<apex:outputField value="{!Universities__C.Owner}"/>

bob_buzzardbob_buzzard

Owner is the related record, you need to bind the field itself, which is the id.  E.g.

 

<apex:inputField value=" {!Universities__c.ownerid} "/>
 
 
<apex:outputField value="{!Universities__C.Ownerid}"/>

 

Vishal GuptaVishal Gupta
thanks bob...it also helped me.
SIVASASNKARSIVASASNKAR

Thanks Bob one probelm was solve but it conn't display the owner name  when I try to display the owner name like as follows

 

<apex:outputField value="{!Universities__c.ownerid}"/>

 

---

I get Output like this

 

owner 

 insted of this

Owner Sivasankar Admin

 

 it cann't display the owner name like Owner Sivasankar Admin

jungleeejungleee

Hi Siva,

 

try this, i think it should work:

 

<apex:outputField value="{!Universities__c.owner.name}"/>

 

regards

Sam

SIVASASNKARSIVASASNKAR

 

Hi Jungleee,

first thanks for replayed me

 

Sorry to say it is not working

bob_buzzardbob_buzzard

How are you retrieving the record?  Are you using a standard controller or a custom controller?

Vishal GuptaVishal Gupta
hey siva, if u r using standard controller then it'll work...i have not done with custom controller
SIVASASNKARSIVASASNKAR

Thanks for replaying 

 

 

i'm Using standard Controller 

jungleeejungleee

Hi

 

If you're using a standardcontroller then the owner.name will work.

 

I just tried this:

 

<apex:page standardController = "Case">
<apex:outputField value="{!Case.Owner.Name}"/></br>
<b>without the outputField attribute : </b>{!Case.Owner.Name}
</apex:page>

 

I get the results as expected i.e.,

 

Owner Name

Owner Name

 

I am not sure why its not working for you.

 

Thanks

Sam

 

SIVASASNKARSIVASASNKAR

Thanks Sir,

 

 

Go to ACCOUNT object --->NEW

 

Hear You can see the field Name like Account Owner Sivasankar Admin

 

I'm using Standard Controller

 

When i try to get ownerid like this 

<apex:outputfield value="{!Account.Ownerid}"/>

 

I got the output like this  Account Owner blank space 

 

<apex:outputfield value="{!Account.Owner.name}"/>

 

I got the output like this  Name blank space 

 

 

But

       i want the output as Account Owner Sivasankar Admin

 

 

please suggest me...

Vishal GuptaVishal Gupta
I have used this code in my VF page and its working....


<apex:page standardcontroller="objName__c">
<apex:outputField value="{!objName__c.Ownerid}"/>
</apex:page>

I guess there might be something missing kindly check it again.
OR
delete the page and try with a new page
bob_buzzardbob_buzzard

How are you accessing the page?  When using a standard controller you have to pass the id of the account you are accessing as a URL parameter, something like:

 

https://kab-tutorial.na6.visual.force.com/apex/AccountOwner?id=0018000000iAiZS

 

if you leave the id blank you will get a new, uninserted record with no owner and thus the field will be null.

Mia Whitfield 8Mia Whitfield 8
Hi - I am trying to do something similar - to link the Case Owner Name in a table column (where the table contains all the cases belonging to this account).  I tried to follow the advice in this thread, but do not quite have it right yet.  Here's my code - any tips where I am going wrong?  Thanks!

<apex:column >                   
                    <apex:facet name="header">  
                        <apex:commandLink target="_self" action="{!ViewData}" value="Case Owner{!IF(sortExpression=='OwnerId',IF(sortDirection='ASC','▼','▲'),'')}" >
                            <apex:param value="OwnerId" name="column" assignTo="{!sortExpression}" ></apex:param>
                            <apex:param value="cases" assignTo="{!sortObject}" ></apex:param>
                        </apex:commandLink>
                    </apex:facet>
                    <apex:outputLink value="{!URLFOR($Action.Case.View, ca.Id)}" target="_blank">
                        <apex:outputText value="{!ca.Owner.Name}" />  //Made a change here to use Name.  Needs more changes. This alone causes Loading timer to spin.
                    </apex:outputLink>
                </apex:column>
Mia Whitfield 8Mia Whitfield 8
Never mind, I figured it out.  I switched to the following and it worked fine:
<apex:column value="{!ca.OwnerId}">
                    <apex:facet name="header">  
                        <apex:commandLink target="_self" action="{!ViewData}" value="Case Owner {!IF(sortExpression=='OwnerId',IF(sortDirection='ASC','▼','▲'),'')}" >
                            <apex:param value="{!ca.Owner.Name}"  name="column" assignTo="{!sortExpression}" ></apex:param>
                            <apex:param value="cases" assignTo="{!sortObject}" ></apex:param>
                        </apex:commandLink>
                    </apex:facet>
                </apex:column>
 
Jesus Rodriguez 19Jesus Rodriguez 19
Hi SIVASASNKAR I'm having the same problem. I only see Owner and blank space and Name and blank space. How did you solve it?
Rohan Gupta 4Rohan Gupta 4
Hi all.
It will work when you pass id of account's record in URL as https://c.ap6.visual.force.com/apex/pageName?id=<record id>
 
<apex:page showHeader="false" standardController="Account">
     <apex:form >
         <apex:pageBlock >
         <apex:pageBlockSection >
             <apex:outputField value="{!Account.ownerId}"/>
         
         </apex:pageBlockSection>
             
            
         
         </apex:pageBlock>
     </apex:form>
</apex:page>