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
Jake GharibJake Gharib 

New to VF Page and Controller

Hi all,

I focus more on the Admin side of things in our environment.  I've been messing around with a task to get an "eye popper" to appear on our Account Page Layout.  The goal is to bring in one field into a VF Page called "Account_Status__c".  This picklist contains the values "Active", "Dormant", "Inactive".  We want to place the VF Page in it's own section of the Account Page Layout.  For each value, we want to display them in large, bold letters with a colored highlight.  See highlights below:
  • Active = Green Highlight
  • Dormant = Yellow Highlight
  • Inactive = Red Highlight
Any advice on where to start or how to get this setup as a VF Page with a Controller would be sincerely appreciated.

Thank you~
Best Answer chosen by Jake Gharib
Suraj Tripathi 47Suraj Tripathi 47
Hi Jake,
You can add a VF page as per your requirement.
Now, on the VF page you can add either the Output field as 
<apex:outputField value="Acc.Account_Status__c"  rendered = "{! IF(Acc.Account_Status__c== 'Active', True,False)}" style = " styling as per your need "/>
<apex:outputField value="Acc.Account_Status__c"  rendered = "{! IF(Acc.Account_Status__c== 'Dormant', True,False)}" style = " styling as per your need "/>
<apex:outputField value="Acc.Account_Status__c"  rendered = "{! IF(Acc.Account_Status__c== 'Inactive',True,False)}" style = " styling as per your need "/>
You either use these or you can try using simple HTML output and simply add styling as per your need. 
Also, you can either add the Apex controller to get the value of the Account_Status__c or you can use the Standard Controller as well.

Please mark it as the best answer if it helps you to fix the issue.
Thank you!
Regards,
Suraj Tripathi 
 

All Answers

Fred Kampf 3Fred Kampf 3
Instead, I would suggest creating a formula field with an if statement to display different values.   Use this as a guide.  https://help.salesforce.com/articleView?id=000327122&type=1&mode=1
Suraj Tripathi 47Suraj Tripathi 47
Hi Jake,
You can add a VF page as per your requirement.
Now, on the VF page you can add either the Output field as 
<apex:outputField value="Acc.Account_Status__c"  rendered = "{! IF(Acc.Account_Status__c== 'Active', True,False)}" style = " styling as per your need "/>
<apex:outputField value="Acc.Account_Status__c"  rendered = "{! IF(Acc.Account_Status__c== 'Dormant', True,False)}" style = " styling as per your need "/>
<apex:outputField value="Acc.Account_Status__c"  rendered = "{! IF(Acc.Account_Status__c== 'Inactive',True,False)}" style = " styling as per your need "/>
You either use these or you can try using simple HTML output and simply add styling as per your need. 
Also, you can either add the Apex controller to get the value of the Account_Status__c or you can use the Standard Controller as well.

Please mark it as the best answer if it helps you to fix the issue.
Thank you!
Regards,
Suraj Tripathi 
 
This was selected as the best answer
Jake GharibJake Gharib
Thank you Suraj - there were some tweaks I had to make to get it to work but this was a great starting point for me.  Much appreciated!