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
bohemianguy100bohemianguy100 

Changed Field: bad value for restricted picklist field

I've created a VF page that I'm overriding the view button (detail page) for opportunities.  The related list for Opportunity Field History is causing a problem.  I've read several posts on this issue, but can't seem to get the problem resolved.

 

Here is the error message I'm receiving:

 

Validation Errors While Saving Record(s)
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Changed Field: bad value for restricted picklist field: Travel_Expenses_are__c". 

 Here is my VF page:

 

<apex:page standardController="Opportunity">
<apex:form >
 <apex:sectionHeader title="Opportunity" subtitle="{!opportunity.name}"/>
 <apex:pageBlock title="Opportunity Detail">
 
 <apex:pageBlockButtons location="both">
 <apex:commandButton action="{!edit}" value="Edit" />
 <apex:commandButton action="{!delete}" value="Delete" />
 </apex:pageBlockButtons>
 
 <apex:pageBlockSection title="Opportunity Information" columns="2">
 <apex:outputField title="Opportunity Owner" value="{!opportunity.OwnerId}"/>
 <apex:outputField title="Amount" value="{!opportunity.Amount}"/>
 <apex:outputField title="Account Name" value="{!opportunity.AccountId}"/>
 <apex:outputField title="Approved Min Amount" value="{!opportunity.Approved_Minimum_Amount__c}"/>
 <apex:outputField title="Opportunity Name" value="{!opportunity.Name}"/>
 <apex:outputText title="Budget and Price Me" value="{!opportunity.Price_Me__c}" escape="false" style="float:right;margin-right:135px;" />
 <apex:outputField title="Length of Agreement (Months)" value="{!opportunity.Length_of_Agreement__c}"/>
 <apex:outputField title="Close Date" value="{!opportunity.CloseDate}"/>
 <apex:outputField title="Pricing Approved" value="{!opportunity.Pricing_Approved__c}"/>
 <apex:outputField title="Stage" value="{!opportunity.StageName}"/>
 <apex:outputField title="Pricing Status" value="{!opportunity.Pricing_Status__c}"/>
 <apex:outputField title="Division VP Approval" value="{!opportunity.Division_VP_Approval__c}"/>
 <apex:outputField title="Current Contract Fee Amount" value="{!opportunity.Current_Contract_Fee_Amount__c}"/>
 <apex:outputField title="Probability (%)" value="{!opportunity.Probability}"/>
 <apex:outputField title="Debrief Link" value="{!opportunity.Debrief_Link__c}"/>
 <apex:outputLabel value="" />
 <apex:outputField title="Exclude from Pricing Report?" value="{!opportunity.Exclude_from_Pricing_Report__c}"/>
 </apex:pageBlockSection>
 
 <apex:pageBlockSection title="Contract and Account Information" columns="2">
 <apex:outputField title="Account Net Patient Revenue" value="{!opportunity.Account_Net_Patient_Revenue__c}"/>
 <apex:outputField title="Termination without Cause" value="{!opportunity.Termination_without_Cause__c}"/>
 <apex:outputField title="# Years as Client" value="{!opportunity.Years_as_Client__c}"/>
 <apex:outputField title="Termination without Cause Description" value="{!opportunity.Termination_without_Cause_Description__c}"/>
 <apex:outputField title="Client Since" value="{!opportunity.Client_Since__c}"/>
 <apex:outputField title="Hosp Req'd to Terminate GPO Relationship" value="{!opportunity.Hosp_Reqd_to_Terminate_GPO_Relationship__c}"/>
 <apex:outputField title="Existing Contract" value="{!opportunity.Existing_Contract__c}"/>
 <apex:outputField title="Non-Standard Termination Options" value="{!opportunity.Non_Standard_Termination_Options__c}"/>
 <apex:outputField title="New Contract" value="{!opportunity.New_Contract__c}"/>
 <apex:outputText value="" />
 <apex:outputField title="Auto-Renewal?" value="{!opportunity.Auto_Renewal__c}"/>
 <apex:outputField title="Contract Type" value="{!opportunity.Contract_Type__c}"/>
 <apex:outputField title="Current Agreement Length (months)" value="{!opportunity.Current_Agreement_Length__c}"/>
 <apex:outputField title="Auto-Renewal Periods (months)" value="{!opportunity.Auto_Renewal_Periods__c}"/>
 <apex:outputField title="Contract Expiration Date" value="{!opportunity.Contract_Expiration_Date__c}"/>
 <apex:outputField title="Auto-Renewal Notice Period (days)" value="{!opportunity.Auto_Renewal_Notice_Period__c}"/>
 <apex:outputField title="Current Agreement Initial Annual Fee" value="{!opportunity.Current_Agreement_Initial_Annual_Fee__c}"/>
 <apex:outputField title="Auto-Renew Frequency" value="{!opportunity.Auto_Renew_Frequency__c}"/>
 <apex:outputField title="Current Agreement Fee Structure Type" value="{!opportunity.Current_Agreement_Fee_Structure_Type__c}"/>
 <apex:outputText value="" />
 <apex:outputField title="Current Agreement Fixed Fee %" value="{!opportunity.Current_Agreement_Fixed_Fee__c}"/>
 </apex:pageBlockSection>
 
 <apex:pageBlockSection title="Expected Start Date" columns="2">
 <apex:outputField title="Expected Start Date" value="{!opportunity.Clients_Expected_Start_Date__c}"/>
 </apex:pageBlockSection>
 
 <apex:pageBlockSection title="Proposed New Agreement" columns="1">
 <apex:outputField title="High Risk Factors" value="{!opportunity.High_Risk_Factors__c}"/>
 <apex:outputField title="General Strategy / Tactics" value="{!opportunity.Strategy_Tactics__c}"/>
 <apex:outputField title="Proposed Contract Structure Description" value="{!opportunity.Proposed_Contract_Structure_Description__c}"/>
 <apex:outputField title="Opportunity Notes" value="{!opportunity.Opportunity_Notes__c}"/>
 <apex:outputField title="Previous Barriers/Issues" value="{!opportunity.Previous_Barriers_Issues__c}"/>
 <apex:outputField title="Contract Term Reductions" value="{!opportunity.Contract_Term_Reductions__c}"/>
 </apex:pageBlockSection>
 
 <apex:pageBlockSection title="Proposed Service" columns="1">
 <apex:outputField title="Department" value="{!opportunity.Department__c}"/>
 <apex:outputField title="Service Line" value="{!opportunity.Service_Line__c}"/>
 <apex:outputField title="Project" value="{!opportunity.Project__c}"/>
 </apex:pageBlockSection>
 
 <apex:pageBlockSection title="Closed Lost" columns="2">
 <apex:outputField title="Awarded to" value="{!opportunity.Competitor__c}"/>
 <apex:outputField title="Primary Reason Lost" value="{!opportunity.Closed_Lost_Reason__c}"/>
 <apex:outputText value="" />
 <apex:outputField title="Primary Reason Lost Comments" value="{!opportunity.Primary_Reason_Lost_Comments__c}"/>
 </apex:pageBlockSection>
 
 <apex:pageBlockSection title="Useful Links" columns="2" collapsible="false">
 <apex:outputLink value="https://na3.salesforce.com/servlet/servlet.FileDownload?file=01550000000BCxP" target="_blank" style="float:right;margin-right:250px;" >QHR Client Contact Worksheet</apex:outputLink>
 <apex:outputLink value="http://search.hoovers.com/cgi-bin/hol_search?which=company" target="_blank" style="float:right;margin-right:250px;" >Financial Profile</apex:outputLink>
 </apex:pageBlockSection>
 
 <apex:pageBlockSection title="Additional Information" columns="2">
 <apex:outputField title="Zone" value="{!opportunity.ZoneID__c}"/>
 <apex:outputField title="Opportunity Record Type" value="{!opportunity.RecordTypeId}"/>
 <apex:outputField title="Acct_Div_VP_Email_Address" value="{!opportunity.Acct_Div_VP_Email_Address__c}"/>
 <apex:outputField title="QHR Client On Oppt Created Date" value="{!opportunity.QHR_Client_On_Oppt_Created_Date__c}"/>
 <apex:outputText value="" />
 <apex:outputField title="zz-PricingStatus" value="{!opportunity.zz_PricingStatus__c}"/>
 </apex:pageBlockSection>
 
 <apex:pageBlockSection title="System Information" columns="2">
 <apex:outputField title="Created By" value="{!opportunity.CreatedById}"/>
 <apex:outputField title="Last Modified By" value="{!opportunity.LastModifiedById}"/>
 <apex:outputText value="" />
 <apex:outputField title="Default Start Date" value="{!opportunity.DefaultStartDate__c}"/>
 <apex:outputText value="" />
 <apex:outputField title="Opportunity Record Type Name Static" value="{!opportunity.Opportunity_Record_Type_Name_Static__c}"/>
 </apex:pageBlockSection>
 </apex:pageBlock>
</apex:form>

 <apex:relatedList list="Pricing__r"/>
 <apex:relatedList list="OpenActivities"/>
 <apex:relatedList list="ActivityHistories"/>
 <apex:relatedList list="OpportunityContactRoles"/>
 <apex:relatedList list="OpportunityTeamMembers"/>
 <apex:relatedList list="R00N50000001tDC2EAM"/>
 <apex:relatedList list="NotesAndAttachments"/>
 <apex:relatedList list="OpportunityHistories"/>
 <apex:relatedList list="R00N50000001u8uNEAQ"/>
 <apex:relatedList list="Opportunities__r"/>
 
 <apex:pageBlock title="Opportunity Field History">
 <apex:pageBlockTable value="{!Opportunity.Histories}" var="h">
      <apex:column headerValue="Date" value="{!h.createddate}"/>
      <apex:column headerValue="User" value="{!h.CreatedById}"/>
      <apex:column headerValue="Connection" value="{!h.OldValue}"/>
      <apex:column headerValue="Action" value="{!h.Field}"/>
</apex:pageBlockTable>
</apex:pageBlock> 
 
 <apex:relatedList list="Legal_Tasks__r"/>
 <apex:relatedList list="Proposal_Management__r"/>
 <apex:relatedList list="Revenue_Projections__r"/>

</apex:page>

 If I removed the Opportunity Field History related list section, the page works fine and I do not get the error message.  So, the issue is with the Field History related list.

 

<apex:pageBlock title="Opportunity Field History">
 <apex:pageBlockTable value="{!Opportunity.Histories}" var="h">
      <apex:column headerValue="Date" value="{!h.createddate}"/>
      <apex:column headerValue="User" value="{!h.CreatedById}"/>
      <apex:column headerValue="Connection" value="{!h.OldValue}"/>
      <apex:column headerValue="Action" value="{!h.Field}"/>
</apex:pageBlockTable>
</apex:pageBlock>

 How do I fix this error?

 

Thanks for any help.

bmabma

You can change this part of your code from:

 

 

<apex:pageBlock title="Opportunity Field History">
 <apex:pageBlockTable value="{!Opportunity.Histories}" var="h">
      <apex:column headerValue="Date" value="{!h.createddate}"/>
      <apex:column headerValue="User" value="{!h.CreatedById}"/>
      <apex:column headerValue="Connection" value="{!h.OldValue}"/>
      <apex:column headerValue="Action" value="{!h.Field}"/>
</apex:pageBlockTable>
</apex:pageBlock>

 

To:

 

<apex:pageBlock title="Opportunity Field History">
 <apex:pageBlockTable value="{!Opportunity.Histories}" var="h">
      <apex:column headerValue="Date">{!h.createddate}"</apex:column>
      <apex:column headerValue="User">{!h.CreatedById}"</apex:column>
      <apex:column headerValue="Connection">{!h.OldValue}"</apex:column>
      <apex:column headerValue="Action">{!h.Field}</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>

 

bohemianguy100bohemianguy100

Thanks for the help.  It did prevent the error, but I'm having some formatting problems.  The User displays the GUID instead of the name.  The action just displays the field API name instead of "Changed old field label name to new field label name". 

 

Do you know how I can get those columns to format correctly?

 

Thanks.