• John Guthmiller
  • NEWBIE
  • 0 Points
  • Member since 2018

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 0
    Replies
I want my banner to simply say something that references the picklist option selected (I know I can do this with just visualforce, but would like to add more than the picklist option (for example: "The promotion for this opportunity is: [promo]"), but I keep on getting the  "Content cannot be displayed: SObject row was retrieved via SOQL without querying the requested field: Opportunity.Promotion_Code__c" error. Any help is appreciated. Here's my visualforce and controller code:

VF Code:
 <apex:page standardController="Opportunity" extensions="PartnerPromotionBanner">
  
 <marquee id="banner" rendered="{!Msgid}" style="box-shadow: 0px 0px 15px black; border-radius: 5px; padding: 10px; background-color: #FF0000; font-weight: bolder; font-size: 16px; margin: 10px; color: #FFFFFF font-family:'Lucida'">{!Promo}</marquee>

</apex:page>

Controller Code:
public class PartnerPromotionBanner {
    private final Opportunity opp;
    
     public String showMsg { get; set; }
     public boolean  Msgid { get; set; }
    
     public PartnerPromotionBanner(ApexPages.StandardController stdController) {
     this.opp = (Opportunity)stdController.getRecord();
    }

    
    public string getPromo() {
        if (opp.Promotion_Code__c == 'FinServ Bundle Promo')
        {
            return 'The promotion for this opportunity is: ' + opp.Promotion_Code__c;
        }
        return opp.Promotion_Code__c;
    }
 }