2

So I've been reading up on Workflows, Triggers and Email Alerts and what I want to do appears possible without having to write custom Apex stuff.

Our objective is to send email reminders to customers when their yearly maintenance contrats are about to expire.

So I have created a custom field in the Standard object Accounts, called Maintenance Start Date__c. And created a Workflow rule (Create>Workflow & Approvals>Workflow Rules) for Account with a Rule Criteria formula that should evaluate to true as the DATE field is NOT null.

ex. NOT( ISNULL( Maintenance__c ) ).

My logic is that a Time-Dependent Workflow Action of say 345 Days After Account: Maintenance start date will trigger an email alert. For the email addresses I'm starting with just a test email to myself as a User.

Evaluation Criteria :  created, and any time it’s edited to subsequently meet criteria

But the alert is not working when I enter a date in the Maintenance Start Date__c field which is backdated to over 345 days. Both workflow and alert are "Active". Any advice would be appreciated.

6
  • your example WF criteria rule -- shouldn't it be NOT(ISBLANK(Maintenance_start_Date__c)) ? If yes, pls edit your post. BTW, the general approach to these issues is to look at Setup | Monitor | Time-based workflows as well as turn on debug log for yourself, repeat the test, and then examine the Workflow section of the log
    – cropredy
    Commented Nov 28, 2014 at 17:02
  • Thanks for the info about Monitor and Debug as I wasn't aware of these functions in SF. About the expression, SF says ISBLANK has the same functionality as ISNULL, but also supports text fields. Either way my Alert is not getting sent :( The field name/label is Maintenance start date but the API Name is Maintenance__c (which is what gets inserted with "Insert Field" button)
    – Adrian
    Commented Dec 2, 2014 at 14:29
  • From the Log it would appear I have no WF action :
    – Adrian
    Commented Dec 2, 2014 at 14:34
  • 14:49:20.354 (354739398)|CODE_UNIT_STARTED|[EXTERNAL]|Workflow:Account 14:49:20.373 (373889249)|WF_RULE_EVAL_BEGIN|Workflow 14:49:20.373 (373924716)|WF_CRITERIA_BEGIN|[Account: Adi 001e000000RjLao]|Account Alert Maintenance|01Qe000000055fV|ON_CREATE_OR_TRIGGERING_UPDATE 14:49:20.374 (374097045)|WF_RULE_NOT_EVALUATED 14:49:20.374 (374156104)|WF_SPOOL_ACTION_BEGIN|Workflow 14:49:20.374 (374164550)|WF_ACTION| None 14:49:20.374 (374167944)|WF_RULE_EVAL_END
    – Adrian
    Commented Dec 2, 2014 at 14:35
  • 14:49:20.374 (374176698)|WF_TIME_TRIGGERS_BEGIN 14:49:20.377 (377129476)|WF_TIME_TRIGGER|[Account: Adi 001e000000RjLao]|345 after 00Ni000000FPup0|Account Alert Maintenance 01Qe000000055fV|08:00:00.000 14:49:20.386 (386051342)|WF_ACTIONS_END| None 14:49:20.386 (386059330)|CODE_UNIT_FINISHED|Workflow:Account
    – Adrian
    Commented Dec 2, 2014 at 14:36

1 Answer 1

0

Preamble (altered to reflect comment trail)

With a rule NOT( ISNULL( Maintenance__c ) ) and workflow evaluation criteria of:

Evaluation Criteria :  created, and any time it’s edited to subsequently meet criteria

The workflow rule only executes if the value of the field changes from null to nonNull or when the record is created.

The workflow will not evaluate at all if the Maintenance__c changes from one non-null value to another non-null value as that won't "subsequently meet criteria" (true is still true). Note, for time-based workflows, the Every time it is edited evaluation radio button is not available.

Once the time-based workflow is entered for the object, the object stays in that workflow until the time-based condition is no longer true (maintenance start date becomes null) or the time trigger finally happens (345 days after account.maintenance_start_date__c). If the maintenance start date is changed on the Account, the time based trigger adjusts accordingly per the doc:

What happens if I update the value of a date field used in a time trigger? If you update the date field used in a time trigger, Salesforce recalculates the time trigger as long as the time trigger has not yet fired and the recalculation does not reschedule the time trigger to a date in the past.

For example, if a workflow rule alerts the opportunity owner seven days before the opportunity close date and the close date is set to 2/20/2008, Salesforce sends the alert on 2/13/2008. If you update the close date to 2/10/2008 and the current date is 2/2/2008 or before, Salesforce reschedules the alert for 2/3/2008. The evaluation date of pending actions is ALWAYS reevaluated and updated if necessary irrespective of the rule criteria. Of course, if the rule is evaluated to false, it does not matter as the actions are removed from the queue.

If you were backdating to a date in the past, per the doc, the time trigger does not adjust

3
  • Thanks for this insight. Unfortunately SF says with that option "Created, and Every time it's edited" that "You cannot add time-dependent workflow actions with this option." Any other workarounds possible ?
    – Adrian
    Commented Dec 3, 2014 at 8:52
  • ah right, one more thing I should have checked; edited post
    – cropredy
    Commented Dec 3, 2014 at 18:55
  • Thanks. I can create an Account and enter a maintenance start date ex. 1-2-2012 which is well beyond the 345 days set by the time trigger and it works --> 345 Days After Account: Maintenance start date. However I needed a workaround for the issue of Evaluation Criteria "Every time it is edited" to remain true if I want to edit the date. My workaround is a bit messy but I can clear the date, save the changes and re-enter a new date and it works like a gem because the value of the field is changing from null to nonNull :)
    – Adrian
    Commented Dec 4, 2014 at 10:01

You must log in to answer this question.

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