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
function DownloadFilesFromRepo { | |
<# | |
.SYNOPSIS | |
This function retrieves the specified repository on GitHub to a local directory with authentication. | |
.DESCRIPTION | |
This function retrieves the specified repository on GitHub to a local directory with authentication, being a single file, a complete folder, or the entire repository. | |
.PARAMETER User |
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
List<CronTrigger> listCronTrigger = [select Id, CronExpression, EndTime, NextFireTime, OwnerId, | |
PreviousFireTime, StartTime, State, TimesTriggered, TimeZoneSidKey from CronTrigger | |
where State = 'Waiting' or State='Running']; | |
System.debug('No of jobs: '+listCronTrigger.size()); | |
If (listCronTrigger.size() > 0) | |
{ | |
for (Integer i = 0; i < listCronTrigger.size(); i++) |
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
function FormatToCurrency(num) { | |
num = num.toString().replace(/\$|\,/g,''); | |
if(isNaN(num)) | |
num = "0"; | |
sign = (num == (num = Math.abs(num))); | |
num = Math.floor(num*100+0.50000000001); | |
cents = num%100; | |
num = Math.floor(num/100).toString(); | |
if(cents < 10) |
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
trigger AttachmentTrigger on Attachment (before insert) { | |
set<String> setExtNotAllowed = new set<String> {'exe','dll'}; | |
for (Attachment attachment :Trigger.new) { | |
String strFilename = attachment.Name.toLowerCase(); | |
List<String> parts = strFilename.splitByCharacterType(); | |
if(setExtNotAllowed.Contains(parts[parts.size()-1])) { | |
attachment.addError('File with extension exe or dll could not be attached!!'); | |
} | |
} | |
} |
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
global Datetime addBussinessDays(Datetime startDate, Integer iDays) | |
{ | |
Datetime endDate = startDate.addDays(iDays); | |
Integer iOffDays = daysOff(startDate,endDate); | |
return endDate.addDays(iOffDays); | |
} | |
global Integer daysOff(Datetime sdate, Datetime edate) | |
{ | |
Integer iCount = 0; |
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 static Datetime addBusinessDays(Datetime startDate, Integer numberOfDays, id busniesshourId) | |
{ | |
Integer count = 0; | |
while (count < days) { | |
startDate = startDate.addDays(1); | |
if (BusinessHours.isWithin(businesshourId, startDate)) | |
count++; | |
} | |
return startDate; | |
} |
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
Long interval = 24 * 60 * 60 * 1000; | |
h m s ms | |
Datetime dt = DateTime.newInstance(2017, 12, 18, 10,0,0); | |
System.debug('Date :' + dt.format()); | |
Long interval = (24 * 60 * 60 * 1000); | |
Datetime newdt = BusinessHours.add(bh.Id, dt, interval); | |
System.debug('After adding 1 day :' + newdt.format()); | |
//OUTPUT | |
22:12:52:003 USER_DEBUG [3]|DEBUG|Date :12/18/2017 10:00 AM |