+ Start a Discussion

Data value too large. Apex Visualforce error.

I'm getting this error:

System.DmlException: Insert failed. First exception on row 0; first error: STRING_TOO_LONG, Subject: data value too large: Review final judgement; Teleconference with opposing counsel to correct Final Judgement (max length=80): [Subject]

Why is this error occurring, how can I fix these errors? Do I have to manually put a Check for Field length in APEXclasses when saving records? If so, That would be very tedious :( .. is there amny better idea to fix this issue? :)



I suspect that if you use an inputfield there would be some automated checking(with an unfriendly error message). Your other option, as you mentioned is error checking in your code, or javascript attached to the fields that won't allow the values to be too long.





A slightly offtopic question: 



when doing a controller.save() in my code the message/ error for a rich-text-area is only seen in the debuglog but doesn't show up on the page or is catchable via code. do i miss something? i only want to catch this error and do something else ...



VF_PAGE_MESSAGE|EmailBodyRich: data value too large: 




Well, got it i think.


Just getting the record and checking the field size before the controller.save.

If it's > 32 000 then i can do something else ...




et =  (EmailDraft__c)controller.getRecord();