For one of our clients we had a requirement where 3 days after closing opportunity a welcome letter needed to be sent out. The closure action was tracked using two fields Status (Closed) and Closed Date (Date when opportunity was closed). There was an action in workflow to send out the Welcome Letter to clients; however large number of users using it was clicking it before 3 days after closure. Hence we had decided to implement the workaround so that the Rule will be visible only when 3 days are passed after closure. We followed below steps to put the below script on workflow rule to perform the validation.
- Go to the Administration | Advanced Customization | Workflow.
- Click on the your “OpportunityWorkflow”
- Click on the “Edit Workflow” button.
- Then click on the rule name that you want to apply the condition
dOppoClosed = new String(Values(“oppo_closed”));
if(dOppoClosed==”null” || dOppoClosed==”Undefined”)dOppoClosed=””;
//’If date is blank then rule appeared else not appear
if(dOppoClosed == “”)
- Click on the “Save” button.
- Click on the “Activate Workflow” button.
This content explains how you can validate date fields to apply some conditions on workflow actions.