Category: Sample codes
-
Salesforce: Adding specific business days to a date using BusinessHours class
Businesshours is a system class provided by Salesforce for performing various operations on the DateTime values. It provides methods for checking if a date falls during business hours, whats the diff between two dates in business. The in-built method does allow adding the specific days to the DateTime value but there is a catch, it…
-
Salesforce: Adding specific working days to a Date
UPDATE: If you want to consider holidays and business hours you can check out this article. Many time while coding we come across the requirement in which we need to calculate the EndDate from a StartDate after a specific number of business/working days. That means excluding the weekends (Saturday & Sunday) Following is the code snippet which does…
-
Showing the Processing/Loading image
I came across a good code sample while surfing for showing the Loading/Processing image on the VisualForce Page. You can find it at: http://force.siddheshkabe.co.in/2009/10/displaying-please-wait-ajax-animation.html
-
Regex for AlphaNumeric password validation
Regular Expression for validating the string (?!^[0-9]*$)(?!^[a-zA-Z]*$)^([a-zA-Z0-9]{8,20})$ The above RegEx requires at least one digit, at least one alphabetic character, no special characters, and from 8-20 characters in length.
-
JavaScript: Number to Currency format conversion function
JavaScript for converting string to currency format. https://gist.github.com/prasannadeshpande/91a3212f041fcec3e4f3d9dac5923c89