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
rajgopal10rajgopal10 

Rule criteria based on some time period

Hi,

I want to fire a workflow rule when the time periond 2016 to 2015, so how i can achieve this.

Please suggest.
example:   renewaldate= 01-13-2014( workflow not fired)
                renewaldate=01-15-2015(workflow fired)

Regards,
Raj
 
Michael Adrian AlcazarMichael Adrian Alcazar
- Did you create a Workflow Time Trigger Action?
- Also make sure the the date Format is the same, (3/14/2016)
 
Patrick KaiserPatrick Kaiser
You can use the YEAR( date ) to get the year and then just check if the result ist 2015 or 2016
​https://help.salesforce.com/HTViewHelpDoc?id=formula_examples_dates.htm
Mahesh DMahesh D
Hi Raj,

I would like to share one solution with you.

Check these conditions in the trigger and populate a boolean field to fire the Workflow. Make sure that the boolean field is false as part of the workflow so that it will be used for next time workflow to fire.

Example code:
 
for(Contract con: Trigger.new) {
    if(con.RenewalDate != Trigger.oldMap.get(con.Id).RenewalDate && con.RenewalDate.year() < Trigger.oldMap.get(con.Id).RenewalDate.year()) {
		con.isWorkflowToFire = true;
​	}
}

Please do let me know if it helps you.

Regards,
Mahesh