Last active
August 29, 2015 14:02
-
-
Save kiran-machhewar/51d2daedd8e33aded3bd 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