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
Shravya Rama 9Shravya Rama 9 

Validation rule prevented time based work flow rule to trigger

Hallo all,

1. I have a validation rule that Starttime field should always be greater than the current time.
2. I have a time based workflow rule which changes the status field, after 15 minutes from valid Start time field value.

I got a mail saying that the this workflow rule failed to fire because of validation rule. Is there any way to fire this workflow rule even when validation rules are not satisfied or any other work around for this.

 
pkpnairpkpnair
please put the screen shots of your workflow and validation rules
Shravya Rama 9Shravya Rama 9
Workflow rule is as follows
User-added image
Validation rules are generated from apex class
if(res.Start__c < system.now()){

ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'Start Time should always be greater than current time'));    

}
else if(res.end__c < res.Start__c ){

ApexPages.addmessage(new ApexPages.message(ApexPages.severity.WARNING,'End Time should always be greater than the start time'));   
}
Start Datetime in Time dependent work flow actions is a formual field which generates 45 minutes less than the start time. so when I say 1 hour after StartDatetime, rule corresponds to 15 minutes after Start time.

 
pkpnairpkpnair
Could be that your formula to calculate StartDatetime from Start time  is not correct. Then now() will be > or = Start_c.
Shravya Rama 9Shravya Rama 9
No my StartDatetime field is working fine and i can see the exact time(45 minutes earlier to start time). I can also see that the record got queued up in monitoring time based workflows with proper scheduled date. But yet is not getting fired after the scheduled date.
EldonEldon
Hi Shravya

Check out this issue 'Do time-dependent workflows verify the rule criteria is still true before executing?' http://salesforce.stackexchange.com/questions/8097/do-time-dependent-workflows-verify-the-rule-criteria-is-still-true-before-execut

Also check out the considerations for Time-Dependent Actions and Time Triggers
https://help.salesforce.com/articleView?id=workflow_time_action_considerations.htm&language=en&type=0


Regards
Shravya Rama 9Shravya Rama 9
There isnt any problem with my workflow rule. It matches all the criteria and it used fire before I added the validation rule that 'start time should always be greater than current time'.

Now the problem is, at scheduled time, time based workflow trigger re executes the code and checks if at all the code is still valid for evaluation criteria. Along with evaluation criteria, it is also checking for validation rule('start time should always be greater than current time') which would obviously go wrong since I am triggering this time based  rule after 15 minutes from the start time.