I have a custom page, and it has a field which is inline editable. If the value of the field is changed to null, an apex page message is displayed, the logic of which is written in the controller:

if(flag==1) {
   ApexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO,'Invalid Value'));
   return null;
else {
   database.update(List, true);
return new PageReference(
   isSubmitter ?
      UrlModel.SubmitterMenuUrl(ActiveSubMenu, ActiveTile, Id) :
      UrlModel.PubMenuUrl(ActiveSubMenu, ActiveTile, PubId)

When the page message is displayed on the page, the field also shows a null value. What I want is for the previous value of the field to be displayed along with the page message. Is that possible?

1 Answer 1


By "previous value" I assume you mean the person has arrived to the page by clicking edit, and that the form is already populated with valid data.

This would mean that there is some object somewhere maintaining that state. (Are you using a standard controller? Or a controller extension? Code snippet doesn't make this clear)

Anyway, before you return null (line 3) you could reset the object (or just the field) by re-querying the field. Or better yet, take it from a copy you made in the controller constructor.

As an aside, what you're trying to do might lead to some confusing UX. The error message says "Invalid Value" but the field has the old, valid value.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .