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
RizzyOneRizzyOne 

How to send email alert after several days and given rule criteria

Hello,

I'm trying to get a workflow to work where I will send an email alert after 10 days of an order creation and with the order status being equal to "pending" or "processing".  What I have is a time trigger for 10 days after the order creation date, and in the rule criteria I have the following:

OR(ISPICKVAL(ECS__Order_Status__c, "Pending"), ISPICKVAL(ECS__Order_Status__c, "Processing"))


I also tried it like this where I used a custom field "Days_Since_Creation__c" where the formula is "ROUND(TODAY() - Creation_Date__c, 0)" instead of the time trigger, and in the rule criteria I had the following:


OR(ISPICKVAL(ECS__Order_Status__c, "Pending"), ISPICKVAL(ECS__Order_Status__c, "Processing")) && Days_Since_Creation__c = 10

 

 

None of these are working. Does anyone know what could be wrong?

 

Thanks.

Vz123Vz123

hi,

 

Try ROUND( NOW() - CreatedDate,0) for Days Since creatation.

and put the rule creteria as 

 

AND(Days_Since_Creation__c = 10 , OR( ISPICKVAL(ECS__Order_Status__c, "Pending"), ISPICKVAL(ECS__Order_Status__c, "Processing")))

 

hope this helps.

 


Thanks,

RizzyOneRizzyOne

Hi,

 

I tried that but it still doesn't work. 

 

I'm thinking the formula, although it changes values, doesn't actually trigger an update on that order record, and therefore the rule criteria doesn't execute at all. If this is right, then what would be another way of causing the email alert to be sent?

 

Thanks. 

Vz123Vz123

hi.

Check how  the Status fields are  getting update to Pending or Process state,

 

Below Workflow should work actually:

Put

Rule Criteria: ISPICKVAL(ECS__Order_Status__c, "Pending") OR ISPICKVAL(ECS__Order_Status__c, "Processing")


Evaluation Criteria : When a record is created, or when a record is edited and did not previously meet the rule criteria


And then added Time-Dependent Workflow Actions, where Add Time Trigger as 10 days after the Order Creation date.


And Workflow Action as Send Email alert.

 

 


RizzyOneRizzyOne

The thing is that I want the email alert to be sent even if the status was already "Pending" or "Processing".On the 10th day, the order status doesn't necessarily change.

 

So if on day 9 the order status is "Pending" and on day 10 the order status is still "Pending", the email alert should be sent.

 

If I find a record with Days_Since_Creation__c = 10, and I manually change the order status from "New" to "Pending, then I am successfully able to trigger the email alert. But that doesn't seem to be happening through the normal flow of things because the order status doesn't necessarily get edited on the 10th day, and the Days_Since_Creation__c formula doesn't seem to count as an edit. 

Vz123Vz123

Thank you for explaining the requirement.

 

The other option is Scehduler Jobs using Apex Scheduler and using Apex Email Services for sending email.