+ Start a Discussion

WF - email Alert



I have a trigger that counts the number of close cases for each contact, now I want to send an email alert each times when the close case is , 1,3,6,9,12,15.....etc....



Any ideas on setting this rule without having to write all numbers until 500!!!

Any tricks??


Thank you

AND(( Items__c =1)  ||  MOD(Items__c,3) = 0)


I have managed to create the WF email alert with this formula.:)


Now a second question:


How can I say if item__c value is repeated do not send the email alert.


This is because I might have the value number 6, which fires the Alert but if I delete o reopen a case, the value will turn to 5, then if I close the case again is back to 6 and I do not want to send the Email alert if the item__c fields is repeated.??


Any idea???





You could add a field update to your workflow rule, which updates a custom field, Last_Items__c, with the current value of Items__c. Then, you can add criteria to your workflow rule so that it only evaluates to true if Items__c is greater than the value in Last_Items__c. So, your rule would look like this:

AND(OR(Items__c=1, MOD(Items__c,3)=0), Items__c > Last_Items__c)

 This way, once your rule fires for a certain value of Items__c, it cannot fire again until Items__c has a greater value.


I have tried this but if the field update is in the same workflow it won't fire as this is not happening???

Thank you!


AND(OR(Items__c=1, MOD(Items__c,3)=0), Items__c > Last_Items__c

This shouldn't be a problem, because the field update occurs after the workflow fires. Make sure you set the Evaluation Criteria to "Every time a record is created or edited." This rule will not work with the default Evaluation Criteria of "When a record is created, or when a record is edited and did not previously meet the rule criteria."


Doing as you mention


field "Last item" populated with item__c


and WF criteria:

Every time a record is created or edited


AND(OR(Items__c=1, MOD(Items__c,3)=0), Items__c > Last_Item__c)


but last item doesnt gets populated.

I will run a debug to see if the workflow is firing




Sorry, it's probably not firing because there is no value in Last_Items__c. Try

AND(OR(Items__c=1, MOD(Items__c,3)=0), OR(Items__c > Last_Items__c, ISBLANK(Last_Items__c)))

 This way, if the workflow rule hasn't run yet, and Last_Items__c is blank, it will still fire if Items__c is divisible by 3 or equal to 1.


Thanks again dude! but modified as you mentioned and reach number 9, and no email fired!


any other ideas!! I really appreciate your help!:)


Hmm... that is interesting. What is the value of Last_Item__c?


it is based on a trigger that counts the total of close cases per contact.


So it will depend on this!:)



Based on the workflow that we discussed above, Last_Items__c should be set to equal Items__c whenever Items__c is divisible by 3 and greater than Last_Items__c. Whenever this happens, the email action should trigger as well, as it is based on the same workflow rule.


You said that when Items__c reached 9, an email was not sent. What was the value of Last_Items__c on that specific record at the time that Items__c reached 9?


Thank you for your help again


The value for Last_Items__c was 9, it is copying the Items__c


Okay, that is why it did not send the email. The workflow rule triggers if Items__c is divisible by 3 and is greater than Last_Items__c. This second criteria is very important, because it prevents the workflow rule from firing again for the same value of Items__c. If the value of Last_Items__c was equal to 9 when Items__c was updated to 9, the workflow email would not trigger.


ok, grand but i started with


"You could add a field update to your workflow rule, which updates a custom field, Last_Items__c, with the current value of Items__c."


So i might be missing something here, how would you do this part?




The field Last_Items__c stores the value of Items__c when the workflow rule last triggered. This way, whenever you update a record, it can check this field and compare it to the updated value for Items__c. If the new value is greater than the previous value and is divisble by three, the email is sent, and Last_Items__c is updated.


So, your workflow rule needs to have two actions associated with it: the email alert, and the field update. Last_Items__c is updated with the current value of Items__c, but that does not happen until after the rule criteria is evaluated.