function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Tobias HaggeTobias Hagge 

Account.Owner on VF page with label

I would like to have the following functionality rebuild on a VF page. Baiscally the standard functionality

Account Owner FirstName LastName [change]

Best way to get formatting right is putting it in a pageblocksectionitem, otherwise you would need CSS to bring the change button to the right position
 
<apex:pageblocksectionitem>
				<apex:outputlabel> Account Owner </apex:outputlabel>
				<apex:outputfield value="{!Account.Ownerid}"/>
					<a href="/{!id}/a?retURL=/{!id}">[Change]</a>
</apex:pageblocksectionitem>
Unfortunately only 2 items are accepted in the section and the outputfield only displays FirstName LastName. Any good idea how to achieve this?
 
Best Answer chosen by Tobias Hagge
santoshgoresantoshgore
Hi Tobias,

Please refer below code;
<apex:pageblocksectionitem>
				<apex:outputlabel> Account Owner </apex:outputlabel>
               <apex:outputPanel>
				<apex:outputfield value="{!Account.Owner.Firstname}"/>
                                 <apex:outputfield value="{!Account.Owne.Lastname}"/>
					<a href="/{!id}/a?retURL=/{!id}">[Change]</a>
                </apex:outputPanel>
</apex:pageblocksectionitem>

I hope this will work as we are using 'Outputpanel' tag as a container.

Thanks,
Santosh
 

All Answers

santoshgoresantoshgore
Hi Tobias,

Please refer below code;
<apex:pageblocksectionitem>
				<apex:outputlabel> Account Owner </apex:outputlabel>
               <apex:outputPanel>
				<apex:outputfield value="{!Account.Owner.Firstname}"/>
                                 <apex:outputfield value="{!Account.Owne.Lastname}"/>
					<a href="/{!id}/a?retURL=/{!id}">[Change]</a>
                </apex:outputPanel>
</apex:pageblocksectionitem>

I hope this will work as we are using 'Outputpanel' tag as a container.

Thanks,
Santosh
 
This was selected as the best answer
Tobias HaggeTobias Hagge
Thank you very much, that does exactly what I needed.