Adding days to a DateTime field can lead to an unexpected time when the added date passes a daylight savings time. For example, if 7 days is added to 3/9/2018 10:00 AM, the new date will 3/16/2018 11:00 AM because it has passed the daylight savings time date. This occurs because the date is stored…
Read moreCategory: Salesforce
Salesforce Date Formula for Finding the Next Business Day that Skips Holidays
Finding the next business day using a Salesforce formula field can be challenging, and making the formula skip holiday dates increases the complexity. Below is what I’ve come up with after digging through many examples on the web, and borrowing logic that made sense. I would not call this great because it requires updating the…
Read moreGet Record Type ID by Name for a Salesforce Object
Salesforce provides an Apex method for retrieving an object’s record type record id. The method accepts the record type label instead of the developer/api name, and this makes the Apex method sensitive record type label changes. Here is a typical example of the method in use. It strings together methods for the object’s schema, record…
Read moreSalesforce Dashboard Rotation and Refresh with Tampermonkey
Have you ever wanted to rotate through a series of Salesforce dashboards and have them auto refresh? There are multiple questions on the success community and other forums requesting exactly this. The easiest way to rotate through dashboards is to use a browser plugin that switches between pages. However, data in the dashboards can only…
Read moreConvert a number to a string left padded with 0s in Apex
Integer MyInt = 54; String MyString = String.valueOf(MyInt).leftPad(5, ‘0’); system.assertEquals(‘00054’, MyString);
Read more