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
Justin PietrasJustin Pietras 

Workflow formula: Automatic email sent if a custom field is a specific value.

I am working in the opportunity object.  I want the workflow to do two things when the stage date has hit "60" days since it has been changed from Quoting to Proposal:  1.  Update the status from "proposal" to "quoting".  2.  Send an email to specific users.  

I already have a custom field called "Stage Duration", which has a formula of the following, which works perfect:
Today()- Last_Stage_Change_Date__c

My question is...in the formula for the workflow below correct?  
 
AND( 
NOT(IsClosed), 
NOT(ISBLANK(Last_Stage_Change_Date__c)), 
ISPICKVAL(StageName, "PROPOSAL"),
IF(Stage_duration__c =>60)
)

The status changes with a field update as planned, but the email does not send out.  Thoughts?
RbnRbn
Hi Justin,

Please check if your email deliveraity settings is det up to All Emails.

Go to Setup => Email Administration => Deliverability

User-added image

Let me know if it helped you in resolving your issue.

Regrds,
Rabi

 
Justin PietrasJustin Pietras
That has been updated to "All Email".  Is there a way to run a test faster than the minimum 1 hour on this timed workflow rule?  Want to make sure that was the issue before I close this question.  
 
RbnRbn
Justin,

Please go through the below link:

https://sftipshack.wordpress.com/2013/10/21/the-5-minute-time-based-workflow-or-15-minute-or-30-minute/ (http://www.buanconsulting.com/time-based-workflows-that-firein-less-than-1-hour/)

 
jigarshahjigarshah
Justin,

The formula you have written is missing additional parameters in the IF condition to return values if the specified condition holds true and if it is false. Based on your logic, the formula should be rewritten as follows which should help address your issue to evaluate and provide the output as a Boolean result.
AND( 
 NOT(IsClosed), 
 NOT(ISBLANK(Last_Stage_Change_Date__c)), 
 ISPICKVAL(StageName, "PROPOSAL"),
 Stage_duration__c >= 60)
)
Moreover, I would recommend you store the value of 60 within a Custom Label and then refer the Custom Label instead of the hardcoded 60 value. This provides you the benefit, of not requiring the formula field to be redeployed to production, incase the business norms around the Stage Duration cause a change in the days.

Please do not forget to mark this thread as SOLVED and asnwer as the BEST ANSWER if it helps address your issue.
jigarshahjigarshah
Justin,

Are you askign if the duration for execution for a timebased workflow can be reduced to execute lesser than a lag of 1 hour? If that is the question, that is a limitation with a timebased workflow and hence you cannot go lower than that time frame. This is because, Time Based Workflows are queued and do not execute real time.

Hope that helps.
Justin PietrasJustin Pietras
@jigarshah

I receive an error when i use your formula....  

User-added image
jigarshahjigarshah
Sorry, for the typo, there is an extra brace at the end after 60 which you can remove and the formula will work fine. Updated formula is.
AND( 
 NOT(IsClosed), 
 NOT(ISBLANK(Last_Stage_Change_Date__c)), 
 ISPICKVAL(StageName, "PROPOSAL"),
 Stage_duration__c >= 60
)
Please do not forget to mark this thread as SOLVED and asnwer as the BEST ANSWER if it helps address your issue.
Justin PietrasJustin Pietras
@jigarshah . So I used your above formula and neither of the workflow actions fired.  Any thoughts?  Both workflow actions are "Immediate Workflow Actions".  Workflow is active.  My  "stage_duration__c" field is working properly.  
jigarshahjigarshah
Justin,

Can you provide the steps that you are doing to test if the workflow is fired or not. Couple of things to check

1. Have you added the actions to the workflow in consideration
    - Field update to change the Stage from Proposal to Quoting (Add this action first and check if the workflow behaves as desired and then add the next item.)
    - Send Email action

2. The workflow will only fire once the data changes are made to some of the records. I believe the critieria you set is for Created and every time it is edited. So you will need to check the workflow for 2 cases
   - Creating a new Opportunity record which satisfies the workflow execution criteria
   - Update an existing Opportunity record with data that satisifies the workflow execution criteria 

3. Navigate to Setup > Debug Logs. Ensure that the Log Filter for Workflows is set to the FINEST category which captures the granular details associated with workflow execution. Check if the workflow condition evaluates to true. I suspect that may be the possible cause.

Let me know if that helps resolve your issue.
jigarshahjigarshah
The other thing I suspect is that the change in the Stage_duration__c formula will not trigger the workflow. Hence, I believe you may need a time trigger rather than an immediate action.

Try removing the Stage_duration__c >= 60 condition just to test if the workflow executes. If the workflow executes means the change in the number of days will not trigger the workflow automatically and will need a time trigger.