function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Show Standard Field Error Messages in vf


There is a vf page where it contains 2 record type records .

I have a field called Dontcall__c in both record types.
I have a validation rule where a record type :-service  and Dontcall__c :- true and profile :- service it should through an error .
 the validation rule is working fine .

the issue occurs when i edit the VF page and save if there are any already existing records with Dontcall__c true which are checked by other profiles then its giving error on save for service profiles also then i need all the check boxes false and need to save it but those check boxes are not checked by me the are checked by some other profiles.

how to over come this issue in vf on edit and  saving the record.


iam using <apex: page messages/> in vf page to show the standard validation error.

Thanks in Advance


Why not bypass other profiles from Validation rules so that it won't fire for other profile is that serves your purpose.


Hi Vinit 


Thanks for the reply.

This is my validation rule:

AND(RecordType.Name="Service",NOT(OR($Profile.Name = "System Administrator",$Profile.Name = "3. HULT Student Services and Visa Coordinators")), Dontcall__c =True)


We i logged in with other profile user except the above and edit the vf page and save it then its throwing error.

But here i am not updating that field or checking that field.






Try below :-


AND($Profile.Name != '<Name of profile which needs to be bypassed>',RecordType.Name="Service",NOT(OR($Profile.Name = "System Administrator",$Profile.Name = "3. HULT Student Services and Visa Coordinators")), Dontcall__c =True)


Still its not working and giving the error


Not sure as it is not bypassing th Validation rule,it should.The way I would approach here is by checking the debug logs and see what is going on there.