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
NAlmolaNAlmola 

How to prevent email workflows from refiring

During the lifecycle of a ticket being open, particular fields are checked on cases and email workflows are sent out tocustomers. Once the status of those tickets are complete, our case manager reviews the cases and updates any missing fields and saves the record. Unfortuntately the email workflows associated with the fields as mentioned previously are again triggered causing duplicate email notifications to customers.

The current criteria is as follows:
Evaluate the rule when a record is created, and any time it’s edited to subsequently meet criteria

How can we prevent this from happening?
James LoghryJames Loghry
You'll need to update the formula / criteria in your workflow from sending it a second time.  To do this, you could use the ISCHANGED() formula to look at the field, and verify that it was changed to the correct value before firing off the workflow email alert.
NAlmolaNAlmola
Hi James, am not sure how to do this?
This is causing an absolute headaches for our customers and my colleagues at the moment. 
We are currently using a critieria based workflow where many of the workflows follow more or less the same structure:
Rule Criteria: (Case: Arrived OnsiteequalsTrue) and (Case: Case OriginequalsEmail - Service,Phone - Service)

How would we fit this into a formula and take into account the ISCHANGED() rule? Apologies, my formula and coding skills are pretty basic on Salesforce
 
James LoghryJames Loghry

Instead of a Criteria, you would want to change your workflow to  "Run this rule if the following formula evaluates to true"

The formula would look something like the following:

 AND(
    OR(
        ISCHANGED(Arrived_Onsite__c),ISCHANGED(Arrived_Onsite__c)
    )
    ,OR(
        INCLUDES(Origin,"Email - Service")
        ,INCLUDES(Origin,"Phone - Service")
    )
)

I'm guessing at a few things here, namely the API name of the Arrived_Onsite__c field.

Also note that the workflow would still get fired if the user changed the Origin to some other picklist value, then back to either email - service / phone -service.  If you needed to, you could also add in a field on the case, that says something like "Email Sent", which gets updated via the same workflow rule, and then prevent that from happening.

NAlmolaNAlmola
Understood, just tried using the formula but Salesforce returned with this message: Error: Function ISCHANGED may not be used in this type of formula

The fields in question that are associated with the workflows are checkboxes, will this affect the use of the ISCHANGED rule at all? 
StephenKennyStephenKenny
Hi there,

You may be able to use the PRIORVALUE() formula in this case. Something like this:
(Arrived_Onsite__c == TRUE AND PRIORVALUE(Arrived_Onsite__c) == False)

The basicly translates to 'if the checkbox is checked (True) now and previously was unchecked (False)', then do something. When the rule firse again, the priorvalue will be 'True', so your email wont fire.

Please remeber to mark this thread as solved  with the answer that best helps you.

Kind Regards
Stephen