+ Start a Discussion

New field on page layout



I have a requirement to create a custom field with some restriction.


The requirement is, the user should be able to delete the existing text in the filed but should not be able to enter new text into it. To save new value in the field the user has to go to another visualforce page and select the data which satisfies few requirements.


How can I achive this?  Any focus on using validation rules or trigger etc?


Thanks in advance.


Would this work as a validation rule on the field?


AND(ISCHANGED(yourField), yourField<> null)

But it should open for deleting text in it in which case it is Changed.
Do you need to delete all the text or only some of it. Because if you are deleting all of it, that should work. If you are only deleting some of the text, it won't work.

Partial deletion of text is one of the scenarios.


It is something like this, they choose some values from the visualforce page which in turn stored in this field.


If they think that one of the values is not the right one and may want to delete it.


I am not sure how I would do that with a validation rule ...sorry. I would probably write a trigger to handle it, and just compare the initial string with what they have edited and if newString.length() > oldstring.length() and also  do a text comparison - then throw an error. Probably not the cleanest way to do it, but its the best I can think of sorry.