+ Start a Discussion
Shane QuiringShane Quiring 

Visualforce Page Component for a Banner

Hello Experts,

I am extremely new to the APEX Coding and to Visualforce Pages. I am trying to write, or find, an easy way to create a Red Banner, or Scrolling Marque, for my Account pages. Here is what I am trying to do or need:

If a field, Total_Elec_Gas_Avg_Usage__c, is greater or equal to 100,000, then I would like a Banner that states that the company is a "Key Account". You would think that this would be easy to code for. During my search the only thing that I have found is the following:

""the page will something like
<apex:page standardController="Account">
     <b>PUT YOUR TEXT HERE</b>
</apex:page>

and then use this visualforce page at the top of your Account's Page Layout."

Alas, this gives me an error. Now of course I did add it to my profile but still received an error. I would like to keep this as simple as possible. Now I could and am using an image formula for my list views, but I need something more prominent for my Account pages.

Any help would be greatly appreciated, thank-you.

Shane
Best Answer chosen by Shane Quiring
SarfarajSarfaraj
Hi Shane

This will do,
<apex:page standardController="Account">
    <apex:outputPanel style="background-color:red;width:100%;padding:10px;" rendered="{!Account.Total_Elec_Gas_Avg_Usage__c >= 100000}">KEY ACCOUNT</apex:outputPanel>
</apex:page>


All Answers

SarfarajSarfaraj
Hi Shane

What is the error you are seeing? Please post the error message. Also it would be great if you can post your real code or at least a part of it.

Regards
Akram
ShashankShashank (Salesforce Developers) 
Hi Shane,

Can you share the error that you are seeing? Also, you can use conditional rendering in your vf page to display the banner conditionally: http://salesforce.stackexchange.com/questions/45299/conditional-rendering-inside-visualforce-pages

Thanks,
Shashank
Shane QuiringShane Quiring
Hi Shashank and Akram: The error that I am getting is "This URL no longer exists" 

VF Page Error

Now when I used the Developer Console to try and debug the following code:

<apex:page standardController="Account" tabStyle="Account" sidebar="false">
    <apex:sectionHeader title="One of Your Accounts" subtitle="Exciting !"/>
    <apex:detail subject="{!account.ownerId}" relatedList="true" title="true"/>
</apex:page>

I get the following error:

Developer Console Error

Just some more insight on this, I am using the Visualforce Developer's Guide. 

The end result that I am looking for is a red banner with wording of "KEY ACCOUNT" in the banner, when the field Total_Elec_Gas_Avg_Usage__c, is greater or equal to 100,000.

Any assistance is greatly appreciated.

Shane
SarfarajSarfaraj
Hi Shane

This will do,
<apex:page standardController="Account">
    <apex:outputPanel style="background-color:red;width:100%;padding:10px;" rendered="{!Account.Total_Elec_Gas_Avg_Usage__c >= 100000}">KEY ACCOUNT</apex:outputPanel>
</apex:page>


This was selected as the best answer
Shane QuiringShane Quiring
Hi Akram,

That did the trick, thank-you very much for your assistance. One last question for you: How or what coding do I use to make the "KEY ACCOUNT" bigger?

v/r
Shane
SarfarajSarfaraj
Hi Shane

Use this,
<apex:page standardController="Account">
    <apex:outputPanel style="font-size: 40px;background-color:red;width:100%;padding:10px;" rendered="{!Account.Total_Elec_Gas_Avg_Usage__c >= 100000}">KEY ACCOUNT</apex:outputPanel>
</apex:page>

For more css refer this page,
http://www.w3schools.com/css/css_font.asp

Regards
Akram
Shane QuiringShane Quiring
Hi Akram,

Great, thank-you again for you assistance with this.

v/r
Shane
Ross BixlerRoss Bixler
Akram,

Any idea how you can place this VF page above the "Account Detail" section? When I go to add it to the page layout, the page layout editor will not let me add it above that section. I end up being forced to create a new section and put the VF page in there. Thanks!