Can anyone suggest me how to validate field values in case object---for example I have 5 fields and I have a custom button named "Open Case" .When I click on these "Open Case" buttton these button has to validate all fields if any field is empty it throws an error other wise it should open that case
For this my solution would be to use validation rules.
I'm assuming that when "Open Case" is clicked, a field is being updated to indicate that the case is open, we'll call that field Status.
AND(Status = Open OR(ISBLANK(OtherField), ISBLANK(SecondField)))
This error condition formula checks to see if any of otherfield or secondfield is blank, and checks to see if the case status is open.
If anything anywhere in salesforce, be it a button or a bit of apex code tries to change the case status to open while otherfield or secondfield is blank, or tries to blank either of those fields while the case is open, an error will appear.