0

I've never had to do extensive Visualforce, so I'd like to know if the following is possible.


Show Division Logo On Multiple Objects

  • On any given Object, have a field called "Division_Logo__c" which would have a three-letter code.
  • A Visualforce Page/element (or other?) which could be used across multiple Objects, so when placed on a page layout, it reads from the Division_Logo__c" field and then shows IMAGE() similar to a Formula text field

I already have this on several objects as a Formula text field with IMAGE() showing the appropriate logo based on another field.

I'd like to make the displaying of a Division Logo something that I don't have to copy-paste the same Formula text field to each and every object it's needed in (more importantly, so I maintain one copy of the "code").

Any thoughts? Doesn't have to be VF. I'm just looking for a one-size fits-all solution. Having to make a VF page for each object would be just as bad as the current "formula per object" method, UNlESS the code itself could be centralized for maintenance in one place while being usable across "all" objects.


Ideal but unlikely: A way to have a Formula field which references centralized code (similar to Picklist Value Sets). Very loosely related is the "Last Chatter Date" code you can add, which IF THERE IS a field "LastChatterDate__c" on the object, the datetime is updated every time someone Chatters on a record therein.

0

You can do this with Visualforce, in a sense. You just need a component to get started.

logo.component

<apex:component>
  <apex:attribute name="divisionName" type="String" description="The record's division name." />
  <apex:image value="{!CASE(divisionName,'Name1',$Resource.image1,'Name2',$Resource.image2...)} />
</apex:component>

After that, you just need one page per object

accountDivisionLogo.page

<apex:page standardController="Account">
  <c:logo divisionName="{!Account.Division_Name__c}" />
</apex:page>

You just need to copy-paste those three lines to each page (one per object), and change the standardController attribute.

Finally, you can add the page to the record's page layout.

At this point, you only need to maintain the logo component; each page will automatically support any changes you make to the component.

| improve this answer | |
  • This sounds good "on paper". Will definitely check it out. Thanks. – AMM Feb 24 '17 at 20:15
  • By the way, I do not, but I do, believe your Reputation. But I don't. But really I do. (sheesh) ;) – AMM Feb 24 '17 at 20:19
  • 1
    @AMM Thanks! I've spent many, many hours on this site, and I just love giving back to the community that's got your back when you're down. – sfdcfox Feb 24 '17 at 21:03
0

A simplistic approach if it fits people's needs.

On a standard Salesforce URL (not what might be a force.com VF/Apex URL), use:

(instance).salesforce.com / (recordID) ? nooverride=1

This sends you to the default Standard layout. Very very useful in my case. We make the fields read-only, but put all the related lists there, and include a formula field that links to the standard VF page.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.