You need to sign in to do that
Don't have an account?
TracMikeL
Validation Error on VF Page
We are getting the following error when viewing a custom VF page. We have NO validation on the page or the object.
There were custom validation error(s) encountered while saving the affected record(s). The first validation error encountered was "Subject: data value too large: Call Logged with Overlin Zamora RE: Pittsburg High School Reconstruction/Modernization (max length=80)".
Here is my Apex code for that page
SObject[] ClosedTasks = [SELECT (SELECT Id, WhatId, WhoId, LastModifiedDate, Subject, Who.Name, ActivityDate, Status, Priority, Owner.Name, Description, IsTask FROM ActivityHistories ORDER BY ActivityDate DESC, LastModifiedDate DESC LIMIT 500) FROM Opportunity WHERE Id = :o.Id]; myClosedTasks = (List<ActivityHistory>)ClosedTasks.get(0).getSObjects('ActivityHistories');
And here is the VF page.
<apex:page standardController="Opportunity" extensions="trac_Activity_History"> <apex:form > <apex:pageBlock > <apex:pageBlockSection collapsible="false" title="Activity History" columns="1"> <apex:pageBlockTable value="{!myClosedTasks}" var="t"> <apex:column headerValue="Action" width="75px" rendered="{!if(t.IsTask,'true','false')}"> <a href="{!URLFOR($Action.Task.Edit, t.Id,[retURL=URLFOR('/apex/ActivityHistory?Id='+ t.WhatId)])}" target="_top">Edit</a> </apex:column> <apex:column headerValue="Action" width="75px" rendered="{!if(t.IsTask,'false','true')}"> <a href="{!URLFOR($Action.Event.Edit, t.Id,[retURL=URLFOR('/apex/ActivityHistory?Id='+ t.WhatId)])}" target="_top">Edit</a> </apex:column> <apex:column value="{!t.IsTask}"/> <apex:column headerValue="Name"> <apex:outputLink target="_top" value="/{!t.WhoId}">{!t.Who.Name}</apex:outputLink> </apex:column> <apex:column value="{!t.ActivityDate}"/> <apex:column headervalue="Assigned To"> <apex:outputLink target="_top" value="/{!t.OwnerId}">{!t.Owner.Name}</apex:outputLink> </apex:column> <apex:column value="{!t.Status}"/> <apex:column headerValue="Subject" value="{!t.Subject}" /> <apex:column headerValue="Comments"> <apex:outputText >{!t.Description}</apex:outputText> </apex:column> </apex:pageBlockTable> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>
Why would this error occur? Seems odd.
I found a way that works for this.
If I use this for the column
instead of
It works.
All Answers
Hi Rajesh,
Is it ? From the code snippet it seems that data is only populating from the database. SO it should not throw any exception.
You are correct, it is just pulling data. There is NO validation.
Subject is a standard field on Activities so I have no idea why its complaining about this. It's not like we can change the length of that field.
I found a way that works for this.
If I use this for the column
instead of
It works.
Unbelievable , it works in this manner .
Just a quick note to anyone who might find this thread in the future.
I had the same problem when trying to use
but using
didn't work for me.
Oddly enough, I had to use
and that works. Go figure.