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
Adam DunkinAdam Dunkin 

How to change Displayed Id to name on custom object extended page ??

I need to know how to extend a custom object page with APEX, such that I can change what is displayed at the top of the record. Currently the custom object record id is being displayed.  I need to CHANGE that to be the custom object's name ( a custom field on the object ).

So, I have this - " Hunter-{1001} " and I want " Bob Smith " , to display at the top of the " Hunter " object page.

Someone haaaaaaalp!

Thanks! :)
Best Answer chosen by Adam Dunkin
Leslie  KismartoniLeslie Kismartoni
Not exactly, 100% sure what you're asking... My best guess is that you're going to need a bit of VisualForce to accopmlish this.

Try something like - it'll pretty much spit back the basic salesforce pages but allow you to change the title a bit... You can still use the SFDC page editor on YOUR_CUSTOM_OBJECT to move most of the fields around... 
<apex:page standardController="YOUR_CUSTOM_OBJECT__C">
    <apex:pageBlock title="{!YOUR_CUSTOM_OBJECT.YOUR_CUSTOM_FIELD}" mode="view">
        <apex:detail subject="{!YOUR_CUSTOM_OBJECT}" relatedList="true" title="false"/> 
    </apex:pageBlock>
</apex:page>

All Answers

Leslie  KismartoniLeslie Kismartoni
Hi,

Couldn't you just output the field you needed on that custom Visualforce page?
<apex:page standardController="YOUR_CUSTOM_OBJECT__c">
{!YOUR_CUSTOM_OBJECT__c.YOUR_CUSTOM_FORMULA_FIELD__C}!
</apex:page>

(See documentation here: http://www.salesforce.com/us/developer/docs/pages/Content/pages_quick_start_display_field_values.htm)
Adam DunkinAdam Dunkin
HI Leslie,

I CAN do that, but it doesn't fit my need.  I need to replace the default id at the top with the value of 'name' from the custom object.

Isn't there an EASY way to access that field at the top of the page?? :/

Thanks! :)
Leslie  KismartoniLeslie Kismartoni
Not exactly, 100% sure what you're asking... My best guess is that you're going to need a bit of VisualForce to accopmlish this.

Try something like - it'll pretty much spit back the basic salesforce pages but allow you to change the title a bit... You can still use the SFDC page editor on YOUR_CUSTOM_OBJECT to move most of the fields around... 
<apex:page standardController="YOUR_CUSTOM_OBJECT__C">
    <apex:pageBlock title="{!YOUR_CUSTOM_OBJECT.YOUR_CUSTOM_FIELD}" mode="view">
        <apex:detail subject="{!YOUR_CUSTOM_OBJECT}" relatedList="true" title="false"/> 
    </apex:pageBlock>
</apex:page>
This was selected as the best answer
sandeep sankhlasandeep sankhla
Hi Adam,

the custom field which you want to show, that stores Id or Name ?? if that store Name, then as Leslie mentioned above you can directly use that..if that is reference field and stores id then you need to query and get the name first then you can display..

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer 
Adam DunkinAdam Dunkin
Hey Leslie,

I decided to go ahead and implement what you suggested ( plus some CSS ), to ALMOST accomplish what I wanted.  And it's a good-enough solution that it should meet the business need.  So... THANKS! :)

FYI: Here's what I decided on...

User-added image
Thanks again Leslie!!

...she beat you to the punch, Sandeep! ;)
Leslie  KismartoniLeslie Kismartoni
Thanks Adam... Glad to help.
Adam DunkinAdam Dunkin
Yikes! or maybe 'he' ?!  Sorry Leslie! :P

Also, just as a fun tid-bit, here is a link that shows you how to create the 'sectionheader' from scratch on a VisualForce page...

http://salesforce.stackexchange.com/questions/28308/emulate-the-view-pages-using-visual-force

Thanks again, have a good one! :)