Developer Preview Releases for the Google Visualization API
Dreamforce 2008 brought many exciting new features from salesforce.com, both on the CRM/front-end side and the Force.com platform/back-end side. One of the favorites was the announcement that salesforce.com had released a Google Visualization code share project. Google has invited developers to participate in Developer Preview Releases for the Visualization API.
It looks like a pretty cool way to work on RESTful integrations while making some pretty pictures for your users.
For those unfamiliar with the Salesforce/Google Visualization toolkit, developer.force.com has a great introduction.
Project: Lookup to Picklist
In the first installment of post-Dreamforce projects, I present a mechanism to present the user with all available Lookup options in a picklist. This should simplify some Visualforce pages. (Credit to the Developers Guide from the new post-Dreamforce Library.)
The key to the code is the ability to customize the SOQL statement to focus as much, or as little, as the developer would like. Though the code I provide makes no limit on the number of records returned, I encourage developers to limit the select statement as seen fit.
VF Page:
<br />
<apex:page standardcontroller="Child__c" Extensions="ChildExtension"><br />
<apex:messages ></apex:messages><br />
<apex:form ><br />
<apex:pageBlock mode="edit" id="thePageBlock"><br />
<apex:pageBlockButtons ><br />
<apex:commandButton value="Save" action="{!save}"/><br />
<apex:commandButton value="Cancel" action="{!cancel}"/><br />
</apex:pageBlockButtons><br />
<apex:pageblockSection id="ParentList" title="1"><br />
<apex:pageBlockSectionItem ><br />
<apex:outputLabel value="Parent" for="p"/><br />
<apex:selectList id="p" value="{!Child__c.Parent__c}" size="1" title="3"><br />
<apex:selectOptions value="{!ParentOptions}"/><br />
</apex:selectList><br />
</apex:pageBlockSectionItem><br />
</apex:pageblocksection><br />
</apex:pageBlock><br />
</apex:form><br />
</apex:page><br />
Extension:
Note the SOQL query in Line 12 (below) that defines which records are included in the picklist. You can include WHERE and LIMIT statements to get the picklist down to a manageable number of items.
<br />
public class ChildExtension {</p>
<p>private final Child__c child;</p>
<p> public ChildExtension(ApexPages.StandardController controller) {<br />
this.child = (Child__c)controller.getRecord();<br />
}</p>
<p> public List<br />
<selectOption> PositionOptions {get<br />
{<br />
List<br />
<selectOption> parents = new List<br />
<selectOption>();<br />
for (Parent__c prt : [select name from Parent__c pt])<br />
parents.add(new selectOption(prt.id, prt.name));<br />
return parents;<br />
}<br />
private set;<br />
}<br />
}<br />
Because the parents List in the extension sends an ID to the application, it can successfully create a record with the parent Name in the picklist, but the ID in the background. You can also substitute a different field for Name: If you prefer, put a contact’s email address or anything else. Try it out!
One more thing: This is an easy segue into another project, which will be a way to use the traditional lookup interface but to pre-filter the records available in the lookup.
And because I put this in every post: There’s a catch. (There always is.) I’m sure that somewhere in there, Salesforce would prefer that we not create a picklist of a few hundred items. So please feel free to test the limits of this visualforce method, but please be prepared to filter your SOQL query.
On a separate note, I just had lunch with John Rotenstein aka The Enforcer, who already put up a photo of our time in his office. (I think the pirate logo was an accident, but it does add to my sinister persona, no?)
X-Squared at Dreamforce 2008
Please be sure to register for sessions at Dreamforce.
And DEFINITELY don’t miss my session!
Wrangle Data & Pump up the Configuration
“I’m administering Salesforce. I’ve learned the ropes. Now I want to get great!” In this session, we’ll review the latest insights and subtlties that top Salesforce consultants have learned on the front lines. We’ll focus on data and configuration to help cut the time you spend massaging data. You’ll also learn how to implement tricky config quirks you never thought possible.
Speaker: Ezra Kenigsberg, SALESFORCE.COM
Speaker: David Schach, X-Squared On Demand LLC
Date: Monday, November 3
Time: 11:45 a.m. – 12:45 p.m.
I’m on the Administrator track – we’ll be providing tips for configuring your org implementation and optimizations, and for ensuring that things remain smooth as you move forward as a Super Administrator.
Absentee Voting Forms (Necessary for Dreamforce Attendees)
I realized a while ago that Dreamforce would be on Election Day. Somehow it took a while to register (no pun intended) that I needed to fill in an absentee ballot. But where to get one?
Thankfully, there is a website devoted to absentee ballots, http://www.longdistancevoter.org/. Please go to this site and do what is necessary to fulfill your civic duty.
If you want to vote early, which is slightly different, Reed College has a super website on early voting (updated regularly) with information on each state’s policies.
And if I may, I’ll get on my soapbox now: I was born in South Africa, a country where specific groups of people were not only denied the right to vote, but were denied the right to live in certain areas and pretty much every other right that we have in this country. I became a citizen at age 12 and promised my family that I would always do whatever it took to cast a vote in every election I could. Sadly, I broke my promise when I didn’t vote in the 2004 Presidential election. Yes, Kerry carried Illinois, so in retrospect my vote didn’t “matter,” but I still feel bad about it.
Of note, in Australia, not only is it one’s civic duty to vote, but all citizens are REQUIRED to vote. Yes, that’s right. If they don’t vote, they have penalties!
And this year, absentee ballots are predicted by some to be more important than ever.
So please do two things:
- Vote. If you’ll be at Dreamforce, vote absentee. Even if you live in San Francisco, if you don’t want to miss a minute of Dreamforce, you can still vote absentee. You can send in your application pretty much anytime in the month of October, and ballots are due, in general, on Election Day.
- Join me at one of the Ballots and Beer (my label, not theirs) parties Tuesday night in San Francisco. I’m planning to find the one with the most non-profit customers and consultants, as I bet we’ll all be cheering for the same candidate.
See you at Dreamforce, as none of us will see each other at the polls.


