views:

467

answers:

2

So in one part of our customised Salesforce system, the following happens:

  • a trigger changes the value of a picklist on a custom object
  • a Workflow rule detects that change and fires off an email.

Since about the 4th of December though, it seems to have stopped working. edit: The Debug Logs show that the trigger is firing and changing the value of the picklist, but no Worflow Rules are evaluated.

The workflow rule is pretty simple, so I don't really understand whats preventing it. The details of the rule are:

Operates on a custom object.
Evaluation Criteria: When a record is created, or when a record is edited and did not previously meet the rule criteria
Rule Criteria: ISPICKVAL(Status__c, 'Not Started')
Active: Yes
Immediate Workflow Actions: an email alert

Edit: The Rule does fire if I manually update the object to set the appropriate status. But it isn't firing when a trigger changes the status.

Edit: Did something change on Salesforce around December 4th 2009? That seems to be when this stopped working ...

Any ideas?

+1  A: 

If you had said "the trigger does not fire the workflow, even though a manual change via the UI does", I would have responded something like...

Absolutely. That's how it is designed. Salesforce do not allow anything automated to invoke anything automated (ie you cannot start a WF from a trigger or another WF).

Given that you say this stopped working earlier in the month, I am frankly astonished! We wanted to achieve something like this, would have been about 10 months ago, and Salesforce told us it could not be done; they like to keep tight control over processes that could potentially run away and consume large CPU (because of the multi-tenanted nature of the offering), hence the stringent governor limits...

This may have changed recently, of course, we built work-rounds to get round the restriction...

IanR
Thanks for your answer, interesting. I thought Triggers could fire Workflow, and vice-versa. e.g. see this thread: http://groups.google.com/group/npsf/browse_thread/thread/f7392fd57f50400b/0a8866e4a00bbf1e?lnk=raot and particularly this post http://groups.google.com/group/npsf/msg/daee197d11fa39bc. It certainly did work for us, up until Dec 4th...
codeulike
For example, this Apex code documentation says that triggers can fire other triggers, subject to the normal governor limitations on number of updates, etc: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_triggers.htm?SearchType=Stem. I can't find anything official about Workflow and triggers, but a couple of people on the forums say it can be done.
codeulike
Yup - well triggers firing triggers make sense because you can apply DML within your trigger (as long as you don't try to fire the *same* trigger, and cause an infinite recursion problem, obviously)... I will follow up with SF guy today and post back... cheers :)
IanR
A: 

To answer my own question ... I eventually found out what this was.

The Salesforce Spring '09 Workflow Rule and Roll-Up Summary Field Evaluations update was rolled out to all orgs at the start of Dec '09, and changed certain Workflow behaviours.

The update improves the accuracy of your data and prevents the reevaluation of workflow rules in the event of a recursion.

Our particular problem was that we needed Workflow to be evaluated twice on a single object after the initial action - we had a series of changes to a status field that needed to kick off different things. After the Spring '09 update, Workflow is only evaulated once for an action on an object.

So, it did work, but then the platform changed, and it didn't work anymore. Time to write some code.

codeulike