You need to sign in to do that
Don't have an account?

Validation Not Working
Hi All.
I am able to save records that fail the validation. this is not a question about validation rules, they are fine, this is a question about how the hell the user has managed to save such records, on a consistant basis.
Background:
- I have a custom object called Timesheet with some validation rules.
- I have a requirement to allow "manual override" mode. records in this mode have are exempt from the validation rule.
so I added a checkbox called Inclusive_Rate_Validation_Override__c. The validation rules are programmed so that if this checkbox is turned on, the validation rules always allow the record to be saved. - so far so good, if the box is clear, validation rules fire, if checked, the rules don't fire. great!
Plot thickens:
Users sometime click the box by mistake, So I've removed the checkbox from the layout, and created a detail page button to toggle the checkbox for them, after a confirmation dialog.
now here's the problem. I can now consistantly save objects that fail validation. by removing the override mode after changing the values. to clarify, here are the steps:
- Create the record with 'proper' values
- Click the button which checks the box. (I can now put non conforming values)
- change values so that they don't conform to validation , save
(this is not a problem, as validation override is still checked) - use the button to get out of validation mode. (this shouldn't save, as the values dont' conform)
- now I have objects with values that fail validation.
var question = "You are about to ";if ( {!Timesheet__c.Inclusive_Rate_Validation_Override__c}) question+= "DISABLE";else question+= "ENABLE";question+= " manual override for this timesheet.\nAre you sure?"if (window.confirm(question)){ var timesheet= new sforce.SObject("Timesheet__c"); timesheet.id = '{!Timesheet__c.Id}'; timesheet.Inclusive_Rate_Validation_Override__c = {!NOT(Timesheet__c.Inclusive_Rate_Validation_Override__c )}; timesheet = sforce.connection.update([timesheet]); window.parent.location.href="/{!Timesheet__c.Id}";}