0

I have a required field that only needs to be required for some users. (not all) At this time, I have written a validation rule that will only do the validation for the users that I want.

The problem however is that when users are creating / editing the record, there is no red bar showing next to my field. It is only when saving that the user will be presented with the validation rule error.

How can I get the red mark to show on the edit page for the users where the field needs to be required?

2
  • Have you set up the validation rule to display the error against a particular field? Commented Jan 28, 2014 at 10:44
  • yes ,it is possible to have red mark
    – Teja
    Commented Jan 28, 2014 at 10:45

2 Answers 2

4

This isn't possible on standard pages using validation rules - the red "required" marker is only displayed when a field is required, either at the page layout or field level. A validation rule will mark the field when the error occurs, but this is after the user attempts to save.

You can do this in Visualforce, by conditionally rendering some additional classes, but that would mean (a) moving your whole page to Visualforce and (b) having some of your logic in the validation rule (the actual rule) and some in the page (the knowledge about whether to display the field as required to a particular user).

If your rule was specific to a profile rather than a user, you could have a different page layout for each profile and make the field required (or not) at the page level.

0
1

Can you not achieve this with a combination of profiles and/or page layouts, instead of a validation rule?

Make the field required for one profile, and non-mandatory for the other. Or control it at the page-layout level.

You must log in to answer this question.

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