Created
June 4, 2014 18:12
-
-
Save kiran-machhewar/055800ddd701557d3288 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Notification{ | |
/** | |
* @description : | |
* @param jobName Name of the scheduler | |
* @param durationInMinutes Greater duration than the time interval between scheduler executions. | |
*/ | |
public static void addNotificationFor(String jobName, Integer durationInMinutes){ | |
Notification__c notification = new Notification__c( | |
Name = jobName, | |
External_Code__c = jobName, | |
Notify__c = false | |
); | |
upsert notification External_Code__c; | |
//This makes sure that it will meet the criteria to send email | |
notification.Notify__c = true; | |
notification.Notify_After_One_Hour_Of_This_Time__c = System.Now().addHours(-1).addMinutes(durationInMinutes); | |
notification.Last_Run__c = System.now(); | |
update notification; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment