+ Start a Discussion
Justin GreenJustin Green 

Workflow rule not evaluating many records

Sorry to repeat a question, but I'm still not understanding workflow triggers.

We have a set of workflow rules that update fields based on a date field.  For example, Account Status on the account object is updated based on the latest contract end date.  So if the contract end date is tomorrow, the account status is "Active" if the latest contract end date was yesterday, the account status is updated to "Inactive".  

The workflow isn't working.  It will not update the Account Status field unless someone makes and saves a change to an Account object.  This means that we have lots of Accounts where the contract has expired, but the Status still shows "Active".  If I go into a field, make a change, and save the change, THEN the workflow fires.  This isn't a good solution.  We want the field to update whether or not someone saves a change to the account.

Is this a job for Apex, or does an Apex trigger ALSO require an account to be created or updated to fire?
Geoffrey J FlynnGeoffrey J Flynn
You need an apex batch job for this.  A workflow will only fire on save of the record.

The other option would be to see if you can do this with formula fields.  Just throwing that one out there as something to think about.
KCBKCB
Looks like you are doing Cross object update. And Account is a lookup in Contract object not an Master detail Relationship. Hence i would suggest you to write a After Update trigger on Contract to update the Account Status on Account Object. This way if you are having any other workflow rules on account object those will also trigger.
Justin GreenJustin Green
Thanks Geoffrey, that's the answer I was looking for.  I had thought about how to accomplish this as a formula, and found a solution, but it ended up being several additional hidden fields and several series of formulas to achieve the desired result.  Since we also want to auto-generate opportunities, it sounds like we're going to be beefing up on Apex here.

Thanks so much!