Code By Cody
29Feb/12Off

SFDC Randomizer

Posted by Cody Sechelski

Let’s get random here for a moment.

Have you ever needed a random number in Salesforce.com? Or maybe you need to pick a random value from a list or have the system return a random Boolean value. Here is the solution, the SFDC Randomizer class. Install this randomizer class in your org and call the available methods from any other APEX class or trigger.

7Sep/11Off

A Simple Way to Hide and Show HTML Elements Using VisualForce

Posted by Cody Sechelski

The Problem

So you are programing a VisualForce page and you find yourself needing to hide or show  an HTML element on the page. No problem. Here are three simple ways to hide or show one or multiple HTML element just by setting a property on the Controller.

Solution

Option 1 - Postback

A real easy way to hide or show an HTML element is to evaluate a Boolean  property on the Controller. A lot of folks may not realize it, but you can insert the same formulas you use in Validation Rules, Workflow Rules and so on inside any merge field on the page.

13May/11Off

Fix for Salesforce.com Date Picker Year Limitation

Posted by Cody Sechelski

The Problem


So here is a real annoyance with Salesforce.com that I'm sure many of you have seen. When clicking in a date or date/time field, you get this nice little date picker. I have no problem with a date picker, and theirs works pretty good in many cases, but lets say you want to add a date field to an object for a birth date, or something that is far in the past. Look at the picklist for the year in the date picker. You only get a half dozen of so options and most of them are in the future.

Now, you could just select any date, then go into the text field and change it, but some users just don't understand that they can do that.

 

 

The Solution

Truth be told, this is not so much a fix as it is a hack, but it's a good stop-gap solution until Salesforce.com comes up with a solution. It involves injecting some jQuery into a home page component to modify the year picklist in the date picker.