<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>X-Squared On-Demand &#187; Visualforce</title>
	<atom:link href="http://www.x2od.com/cat/salesforce/development/visualforce-development-salesforce/feed" rel="self" type="application/rss+xml" />
	<link>http://www.x2od.com</link>
	<description>Salesforce Configuration, Administration, and Development</description>
	<lastBuildDate>Fri, 11 Jun 2010 16:30:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>New Developer Library Released</title>
		<link>http://www.x2od.com/2009/11/19/new-developer-library-released.html</link>
		<comments>http://www.x2od.com/2009/11/19/new-developer-library-released.html#comments</comments>
		<pubDate>Thu, 19 Nov 2009 17:43:29 +0000</pubDate>
		<dc:creator>David Schach</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Force.com Platform]]></category>
		<category><![CDATA[New Features]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[Winter 10]]></category>
		<category><![CDATA[salesforce.com]]></category>
		<category><![CDATA[Dreamforce 2009]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.x2od.com/?p=853</guid>
		<description><![CDATA[Today, Developer Force (http://developer.force.com) released its new library. Here are a few of them. All can be found at http://wiki.developerforce.com/index.php/Documentation. Workbook http://www.salesforce.com/us/developer/docs/workbook/index.htm Fundamentals http://www.salesforce.com/us/developer/docs/fundamentals/index.htm Cookbook http://www.salesforce.com/us/developer/docs/cookbook/index.htm Apex Advanced Code Example http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_shopping_cart_example.htm https://sites.secure.force.com/appexchange/listingDetail?listingId=a0N30000001saDCEAY And many more to come!]]></description>
			<content:encoded><![CDATA[<p>Today, Developer Force (<a href="http://developer.force.com">http://developer.force.com</a>) released its new library.  Here are a few of them.  All can be found at <a href="http://wiki.developerforce.com/index.php/Documentation">http://wiki.developerforce.com/index.php/Documentation</a>.</p>
<p>Workbook<br />
<a href="http://www.salesforce.com/us/developer/docs/workbook/index.htm">http://www.salesforce.com/us/developer/docs/workbook/index.htm</a></p>
<p>Fundamentals<br />
<a href="http://www.salesforce.com/us/developer/docs/fundamentals/index.htm">http://www.salesforce.com/us/developer/docs/fundamentals/index.htm</a></p>
<p>Cookbook<br />
<a href="http://www.salesforce.com/us/developer/docs/cookbook/index.htm">http://www.salesforce.com/us/developer/docs/cookbook/index.htm</a></p>
<p>Apex Advanced Code Example<br />
<a href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_shopping_cart_example.htm">http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_shopping_cart_example.htm</a><br />
<a href="https://sites.secure.force.com/appexchange/listingDetail?listingId=a0N30000001saDCEAY">https://sites.secure.force.com/appexchange/listingDetail?listingId=a0N30000001saDCEAY</a></p>
<p>And many more to come!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.x2od.com/2009/11/19/new-developer-library-released.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Overload Apex Class to be Controller AND Extension</title>
		<link>http://www.x2od.com/2009/07/24/overload-apex-class-to-be-controller-and-extension.html</link>
		<comments>http://www.x2od.com/2009/07/24/overload-apex-class-to-be-controller-and-extension.html#comments</comments>
		<pubDate>Fri, 24 Jul 2009 20:01:00 +0000</pubDate>
		<dc:creator>David Schach</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[X-Squared On Demand]]></category>
		<category><![CDATA[Eclipse IDE]]></category>
		<category><![CDATA[Force.com Platform]]></category>
		<category><![CDATA[New Features]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.x2od.com/?p=682</guid>
		<description><![CDATA[Coding the new premium version of Mass Update Contacts (details to come), I replaced the two parts of the page with Apex Components. This will allow the app to support custom address fields and international address formats.
I didn't want to write one ControllerExtension for the main page, a CustomController for the view section component, and another CustomController for the pageblocktable component. So here is the overloaded class constructor. Note that this works because an extension passes the StandardController to the constructor, and a CustomController passes nothing:]]></description>
			<content:encoded><![CDATA[<p>Wow - today brought an interesting discovery.  Here's the situation:</p>
<p>Coding the new premium version of Mass Update Contacts (details to come), I replaced the two parts of the page with Apex Components.  This will allow the app to support custom address fields and international address formats.</p>
<p>I didn't want to write one ControllerExtension for the main page, a CustomController for the view section component, and another CustomController for the pageblocktable component.  So here is the overloaded class constructor.  Note that this works because an extension passes the StandardController to the constructor, and a CustomController passes nothing:</p>

<pre class="brush: java;">
public with sharing class VersatileClass {

private Account account;

public VersatileClass(){
	system.debug('OPERATING AS CONTROLLER');
		if(System.currentPageReference().getParameters().get('id')==null){
			//Include error checking here
		} else{
			string AId = System.currentPageReference().getParameters().get('id');
			account = [select id, name from Account where id = :AId];
			//And whatever else you want to do
		}
}

public VersatileClass(ApexPages.StandardController controller) {
	system.debug('OPERATING AS EXTENSION');
		if(System.currentPageReference().getParameters().get('id')==null){
			//Include error checking here
		} else{
			this.account = (Account)controller.getRecord();
			//And whatever else you want to do
		}
	}
}
</pre>
<p>Enjoy!  This should save people a lot of time.</p>]]></content:encoded>
			<wfw:commentRss>http://www.x2od.com/2009/07/24/overload-apex-class-to-be-controller-and-extension.html/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Email Inbox Version 2</title>
		<link>http://www.x2od.com/2009/07/15/email-inbox-version-2.html</link>
		<comments>http://www.x2od.com/2009/07/15/email-inbox-version-2.html#comments</comments>
		<pubDate>Thu, 16 Jul 2009 01:39:41 +0000</pubDate>
		<dc:creator>David Schach</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[salesforce.com]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[X-Squared On Demand]]></category>

		<guid isPermaLink="false">http://www.x2od.com/?p=664</guid>
		<description><![CDATA[Well, it took about ten minutes from the release of Email Inbox Version 1 for people to request additional features, screenshots, etc. Version 2 includes some neat icons, and this post has the multiple-times-requested screenshots we promised. First, a teaser screenshot. (There's a better one below the code.) Here's the updated Visualforce code: &#60;apex:page controller=&#34;EmailMessageController&#34; [...]]]></description>
			<content:encoded><![CDATA[<p>Well, it took about ten minutes from the release of <a href="http://www.x2od.com/2009/07/14/visualforce-email-inbox.html">Email Inbox Version 1</a> for people to request additional features, screenshots, etc.  Version 2 includes some neat icons, and this post has the multiple-times-requested screenshots we promised.</p>
<p>First, a teaser screenshot.  (There's a better one below the code.)</p>
<center><a href="http://www.x2od.com/wp/uploads/EmailInbox-screenshot.JPG"><img src="http://www.x2od.com/wp/uploads/EmailInbox-screenshot-300x50.jpg" alt="EmailInbox screenshot" title="EmailInbox screenshot" width="300" height="50" class="aligncenter size-medium wp-image-672" /></a></center>
<p>Here's the updated Visualforce code:</p>
<pre class="brush: xml;">
&lt;apex:page controller=&quot;EmailMessageController&quot; action=&quot;{!ViewData}&quot;&gt;
    &lt;apex:sectionHeader title=&quot;Email Messages&quot; subtitle=&quot;&quot;&gt;&lt;/apex:sectionHeader&gt;
    &lt;apex:pageblock id=&quot;emailblock&quot;&gt;
        &lt;apex:facet name=&quot;header&quot;&gt;
            &lt;apex:form &gt;
                &lt;apex:panelGrid styleClass=&quot;list&quot;
                    columnClasses=&quot;pbTitle,pbButton,pbHelp&quot; columns=&quot;3&quot; border=&quot;0&quot;
                    cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
                    &lt;apex:outputLabel &gt;&lt;h3&gt;Messages&lt;/h3&gt;&lt;/apex:outputLabel&gt;
                    &lt;apex:commandButton value=&quot; Refresh &quot; styleClass=&quot;btn&quot;
                        action=&quot;{!ViewData}&quot; rerender=&quot;emailblock&quot;&gt;&lt;/apex:commandButton&gt;
                    &lt;apex:SelectList value=&quot;{!wheretext}&quot; size=&quot;1&quot;  id=&quot;controllerselectlist&quot;&gt;
                        &lt;apex:actionSupport event=&quot;onchange&quot; action=&quot;{!ViewData}&quot;
                            reRender=&quot;emailblock&quot;&gt;&lt;/apex:actionSupport&gt;
                        &lt;apex:selectOptions value=&quot;{!views}&quot; /&gt;
                    &lt;/apex:SelectList&gt;
                &lt;/apex:panelGrid&gt;
            &lt;/apex:form&gt;
        &lt;/apex:facet&gt;
        &lt;apex:form &gt;
            &lt;apex:pageblocktable value=&quot;{!Messages}&quot; var=&quot;e&quot; id=&quot;emailtable&quot;
                bgcolor=&quot;#F3F3EC&quot; styleClass=&quot;list&quot; rowClasses=&quot;dataRow&quot;
                onRowMouseOver=&quot;hiOn(this);&quot; onRowMouseOut=&quot;hiOff(this);&quot;&gt;
                &lt;apex:column &gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                        &lt;apex:commandLink action=&quot;{!ViewData}&quot;
                            value=&quot;{!$ObjectType.EmailMessage.fields.Subject.label}{!IF(sortExpression=='Subject', 
                            IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
                            &lt;apex:param value=&quot;Subject&quot; name=&quot;column&quot;
                                assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
                        &lt;/apex:commandLink&gt;
                    &lt;/apex:facet&gt;
                    &lt;apex:outputLink value=&quot;/{!e.Id}&quot; target=&quot;_blank&quot;&gt;{!e.Subject}&lt;/apex:outputLink&gt;
                &lt;/apex:column&gt;
                &lt;apex:column &gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                    {!$ObjectType.Contact.fields.Name.label}
                    &lt;/apex:facet&gt;
                    &lt;apex:outputLink value=&quot;/{!e.Parent.ContactId}&quot; target=&quot;_blank&quot;
                        rendered=&quot;{!IF(e.Parent.ContactId != '',true,false)}&quot;&gt;{!e.FromName}&lt;/apex:outputLink&gt;
                    &lt;apex:outputtext value=&quot;{!e.FromName}&quot;
                        rendered=&quot;{!IF(e.Parent.ContactId != '',false,true)}&quot; /&gt;
                &lt;/apex:column&gt;
                &lt;apex:column &gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                    {!$ObjectType.Account.fields.Name.label}
                    &lt;/apex:facet&gt;
                    &lt;apex:outputLink value=&quot;/{!e.Parent.AccountId}&quot; target=&quot;_blank&quot;&gt;{!e.Parent.Account.Name}&lt;/apex:outputLink&gt;
                &lt;/apex:column&gt;
                &lt;apex:column value=&quot;{!e.FromAddress}&quot;&gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                        &lt;apex:commandLink action=&quot;{!ViewData}&quot;
                            value=&quot;{!$ObjectType.EmailMessage.fields.FromAddress.label}{!IF(sortExpression=='FromAddress', 
                            IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
                            &lt;apex:param value=&quot;FromAddress&quot; name=&quot;column&quot;
                                assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
                        &lt;/apex:commandLink&gt;
                    &lt;/apex:facet&gt;
                &lt;/apex:column&gt;
                &lt;apex:column value=&quot;{!e.Status}&quot;&gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                        &lt;apex:commandLink action=&quot;{!ViewData}&quot;
                            value=&quot;{!$ObjectType.EmailMessage.fields.Status.label}{!IF(sortExpression=='Status', 
                            IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
                            &lt;apex:param value=&quot;Status&quot; name=&quot;column&quot;
                                assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
                        &lt;/apex:commandLink&gt;
                    &lt;/apex:facet&gt;
                &lt;/apex:column&gt;
                &lt;apex:column value=&quot;{!e.MessageDate}&quot;&gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                        &lt;apex:commandLink action=&quot;{!ViewData}&quot;
                            value=&quot;{!$ObjectType.EmailMessage.fields.MessageDate.label}{!IF(sortExpression=='MessageDate', 
                            IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
                            &lt;apex:param value=&quot;MessageDate&quot; name=&quot;column&quot;
                                assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
                        &lt;/apex:commandLink&gt;
                    &lt;/apex:facet&gt;
                &lt;/apex:column&gt;
                &lt;apex:column &gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                        &lt;apex:commandLink action=&quot;{!ViewData}&quot;
                            value=&quot;Inbound/Outbound{!IF(sortExpression=='Incoming', 
                            IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
                            &lt;apex:param value=&quot;Incoming&quot; name=&quot;column&quot;
                                assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
                        &lt;/apex:commandLink&gt;
                    &lt;/apex:facet&gt;
                    &lt;apex:image url=&quot;/img/emailInbound.gif&quot; rendered=&quot;{!e.Incoming}&quot; /&gt;
                    &lt;apex:image url=&quot;/img/emailOutbound.gif&quot; rendered=&quot;{!NOT(e.Incoming)}&quot; /&gt;
                    &lt;!--&lt;apex:outputfield value=&quot;{!e.Incoming}&quot; rendered=&quot;{!NOT(e.Incoming)}&quot; /&gt;--&gt;
                &lt;/apex:column&gt;
                &lt;apex:column &gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                        &lt;apex:commandLink action=&quot;{!ViewData}&quot;
                            value=&quot;Attachment{!IF(sortExpression=='HasAttachment', 
                            IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
                            &lt;apex:param value=&quot;HasAttachment&quot; name=&quot;column&quot;
                                assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
                        &lt;/apex:commandLink&gt;
                    &lt;/apex:facet&gt;
                    &lt;apex:image url=&quot;/img/emailHasAttach.gif&quot; rendered=&quot;{!e.HasAttachment}&quot;/&gt;
                    &lt;apex:outputfield value=&quot;{!e.HasAttachment}&quot; rendered=&quot;{!NOT(e.HasAttachment)}&quot; /&gt;
                &lt;/apex:column&gt;
                &lt;apex:column &gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                        &lt;apex:commandLink action=&quot;{!ViewData}&quot;
                            value=&quot;{!$ObjectType.Case.fields.CaseNumber.label}{!IF(sortExpression=='ParentId', 
                            IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
                            &lt;apex:param value=&quot;ParentId&quot; name=&quot;column&quot;
                                assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
                        &lt;/apex:commandLink&gt;
                    &lt;/apex:facet&gt;
                    &lt;apex:outputLink value=&quot;/{!e.ParentId}&quot;&gt;{!e.Parent.CaseNumber}&lt;/apex:outputLink&gt;

                &lt;/apex:column&gt;
                &lt;apex:column value=&quot;{!e.ToAddress}&quot;&gt;
                    &lt;apex:facet name=&quot;header&quot;&gt;
                        &lt;apex:commandLink action=&quot;{!ViewData}&quot;
                            value=&quot;{!$ObjectType.EmailMessage.fields.ToAddress.label}{!IF(sortExpression=='ToAddress', 
                            IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
                            &lt;apex:param value=&quot;ToAddress&quot; name=&quot;column&quot;
                                assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
                        &lt;/apex:commandLink&gt;
                    &lt;/apex:facet&gt;
                &lt;/apex:column&gt;
            &lt;/apex:pageblocktable&gt;
        &lt;/apex:form&gt;
    &lt;/apex:pageblock&gt;
&lt;/apex:page&gt;
</pre>
<p>The Apex controller code has not changed from <a href="http://www.x2od.com/2009/07/14/visualforce-email-inbox.html">Version 1</a>.  </p>
<p>Here's the screenshot, which includes some emails from around the Salesforce ecosystem:</p>
<center>
<div id="attachment_666" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.x2od.com/wp/uploads/EmailInbox-screenshot-2.JPG"><img src="http://www.x2od.com/wp/uploads/EmailInbox-screenshot-2-300x110.jpg" alt="Incoming (and auto-response) Emails" title="EmailInbox screenshot" width="300" height="110" class="size-medium wp-image-666" /></a><p class="wp-caption-text">Incoming (and auto-response) Emails</p></div></center>

Things to notice and things we've learned:
<ol>
	<li>Salesforce will search ANY Email field to match an incoming email to a Contact. (nice job, Salesforce!) - We know because <a href="http://www.pocketsoap.com">Simon Fell</a>'s Contact.Email is sfell at salesforce.com, and his Contact.Secondary_Email__c is simon at fell.com in the sandbox.  Ditto (with her own email addresses) for <a href="http://www.xlerate.ca/">Irene Brodt</a>.</li>
	<li>Auto-response emails will be included.  We turned off auto-response after a few emails came in.</li>
	<li>Though the Email Address field is coded just to show the field value, Salesforce includes the Gmail link. (We assume that's because we activated the integration, but we may be wrong. Has anyone not activated that?)</li>
	<li>We did not (yet) implement the <a href="http://blogs.salesforce.com/support/2009/03/autocreating-a.html">super Email/Web2Case trigger code</a> that Marco Casalaina posted in the Salesforce Support Blog, but if we had, then every email in the list would be associated with a Contact. (Example: Michael Smith of Force2b.net, who will be a Contact from now on!)</li>
</ol>
Enjoy!  ]]></content:encoded>
			<wfw:commentRss>http://www.x2od.com/2009/07/15/email-inbox-version-2.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Visualforce Email Inbox</title>
		<link>http://www.x2od.com/2009/07/14/visualforce-email-inbox.html</link>
		<comments>http://www.x2od.com/2009/07/14/visualforce-email-inbox.html#comments</comments>
		<pubDate>Tue, 14 Jul 2009 18:00:26 +0000</pubDate>
		<dc:creator>David Schach</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[X-Squared On Demand]]></category>
		<category><![CDATA[salesforce.com]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.x2od.com/?p=642</guid>
		<description><![CDATA[Sonny Cloward, SysAd at Rainforest Alliance, approached us about writing a Visualforce page to display all incoming emails for a given Case Queue. This led to quite a few interesting discoveries. Here's how we handled the project:]]></description>
			<content:encoded><![CDATA[<p>Sonny Cloward, SysAd at <a href="http://rainforestalliance.org/">Rainforest Alliance</a>, approached us about writing a Visualforce page to display all incoming emails for a given Case Queue.  This led a few interesting discoveries.  Here's how we handled the (donated time) project:</p>
<p>First, the page was built upon the <a href="http://salesforcesource.blogspot.com/2008/11/adding-sorting-capability-to.html">template Sam Arjimandi built</a> at <a href="http://salesforcesource.blogspot.com">Salesforce<Source></a>.  Instead of the Account object, we substituted the <a href="http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_objects_emailmessage.htm">EmailMessage object</a>.  But something didn't work.  </p>
Fields have certain <a href="http://www.salesforce.com/us/developer/docs/api/Content/access_for_fields.htm">attributes</a>:<br />
            <table cellpadding="4" cellspacing="0" summary="" class="featureTable">
                <thead align="left">
                    <tr>
                        <th class="featureTableHeader" width="25%" id="d9607e40" colspan="1" rowspan="1">Property</th>
                        <th class="featureTableHeader" width="75%" id="d9607e43" colspan="1" rowspan="1">Description</th>
                    </tr>
                </thead>
                <tbody>

                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435186"><a name="i1435186" shape="rect"><!-- --></a>Autonumber</span>
                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">The <span>API</span> creates an autonumber.</td>
                    </tr>
                    <tr>

                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435191"><a name="i1435191" shape="rect"><!-- --></a>Create</span>
                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">Value for the field can be specified during create using the <span>API</span>.</td>
                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435199"><a name="i1435199" shape="rect"><!-- --></a>Defaulted on create</span>

                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">When created, a default value is supplied if no other value
is specified.</td>
                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435204"><a name="i1435204" shape="rect"><!-- --></a>Delete</span>
                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">Value for the field can be deleted using the <span>API</span>.</td>

                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435212"><a name="i1435212" shape="rect"><!-- --></a>Filter</span>
                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">Can be used as filter criteria in a SOQL query FROM or WHERE
clause.</td>
                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="access_lookup"><a name="access_lookup" shape="rect"><!-- --></a>idLookup</span>

                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">Can be used to specify a record in an <span><a href="sforce_api_calls_upsert.htm" shape="rect"><span><samp class="codeph">upsert()</samp></span></a></span> call. The <span class="fieldName">Id</span> field of each
object has this property and some <span class="fieldName">Name</span> fields. <span>There are exceptions, so check for the property in
any object you wish to <a href="sforce_api_calls_upsert.htm" shape="rect"><span><samp class="codeph">upsert()</samp></span>.</a></span></td>

                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435217"><a name="i1435217" shape="rect"><!-- --></a>Nillable</span>
                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">The field can contain a null value.</td>
                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435222"><a name="i1435222" shape="rect"><!-- --></a>Query</span>

                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">The field can be queried with SOQL using the <span>API</span>.</td>
                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435230"><a name="i1435230" shape="rect"><!-- --></a>Replicate</span>
                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">The value of the field can be replicated using the <span>API</span>.</td>

                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435238"><a name="i1435238" shape="rect"><!-- --></a>Restricted picklist</span>
                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">  A picklist that depends on the value of another picklist
for the values it displays.</td>
                    </tr>
                    <tr>

                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435244"><a name="i1435244" shape="rect"><!-- --></a>Retrieve</span>
                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">Value of the field can be retrieved using the <span>API</span>.</td>
                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="field_access_search"><a name="field_access_search" shape="rect"><!-- --></a>Search</span>

                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">Can be searched with SOSL using the <span>API</span>.</td>
                    </tr>
                    <tr>
                        <td width="25%" headers="d9607e40" colspan="1" rowspan="1"><span id="i1435259"><a name="i1435259" shape="rect"><!-- --></a>Update</span>
                        </td>
                        <td width="75%" headers="d9607e43" colspan="1" rowspan="1">Can be updated using the <span>API</span>.</td>

                    </tr>
                </tbody>
            </table>
<p>The important one here is "Filter" because (as the documentation states) this allows the field to be used in a WHERE clause.  Also, however, (as the documentation does not state) it allows the field to be used in an ORDER BY clause.  So all fields on the EmailMessage object that do not allow filtering/ordering had to be presented plainly, without Sam's cool PageBlockTable sorting features.
Once this was done, Sonny had some great ideas:</p>
<ol>
	<li>Show the email subject, but make that a hyperlink to the email message itself</li>
	<li>Link the Case Number (EmailMessage.ParentId) to the Case (EmailMessage.Parent)</li>
	<li>Show the Case Contact (EmailMessage.Parent.Contact.Name), linking to the Contact (EmailMessage.Parent.ContactId)</li>
	<li>Show the Case Account (EmailMessage.Parent.Account.Name), linking to the Account (EmailMessage.Parent.AccountId)</li>
	<li>Provide filters - Incoming only, Unread only, etc.</li>
</ol>
You'll see in the Apex Code where we added parent object fields to the SOQL query, and where we used a List<SelectOption> to populate the query's filter.  
<pre class="brush: java;">
public with sharing class EmailMessageController {
   public String EmailMessage { get; set; }
   private List&lt;EmailMessage&gt; messages;
   private String sortDirection = 'ASC';
   private String sortExp = 'MessageDate';
   public String wheretext;

   public EmailMessageController(){
   	wheretext = '';
   }

   public String sortExpression { get {
        return sortExp;
     }
     set {
       //if the column is clicked on then switch between Ascending and Descending modes
       if (value == sortExp)
         sortDirection = (sortDirection == 'ASC')? 'DESC' : 'ASC';
       else
         sortDirection = 'ASC';
       sortExp = value;
     }
   }
   
public void setWhereText(String value) {  
   whereText = value;
 }
public string getWhereText(){
	return wheretext;
}
   
public List&lt;SelectOption&gt; getViews(){
	List&lt;SelectOption&gt; options = new List&lt;SelectOption&gt;();
	options.add(new SelectOption('WHERE e.id != null','All'));
	options.add(new SelectOption('WHERE e.Incoming = true AND e.Status = \'0\' ','Incoming Unread'));
	options.add(new SelectOption('WHERE e.Incoming = true AND e.Status = \'1\' ','Incoming Read'));
        options.add(new SelectOption('WHERE e.Incoming = true','All Incoming'));
        options.add(new SelectOption('WHERE e.Incoming = false','All Outgoing'));
        options.add(new SelectOption('WHERE e.ToAddress = \'support@x2od.com\'','Support Queue'));
        options.add(new SelectOption('WHERE e.ToAddress = \'support2@x2od.com\'','Support Queue2')); //etc.
        return options;
}

 public String getSortDirection() {
    //if not column is selected 
    if (sortExpression == null || sortExpression == '')
      return 'ASC';
    else
     return sortDirection;
 }

 public void setSortDirection(String value) {  
   sortDirection = value;
 }
  
   public List&lt;EmailMessage&gt; getMessages() {
       return messages;
   }
   
   public PageReference ViewData() {
       //build the full sort expression
       string sortFullExp = sortExpression  + ' ' + sortDirection;
      
       //query the database based on the sort expression
       messages = Database.query('Select e.FromAddress, e.Parent.ContactId, e.Parent.Contact.Name, e.Parent.Account.Name, e.ToAddress, e.Parent.CaseNumber, e.Parent.AccountId, e.TextBody, e.SystemModstamp, e.Subject, e.Status, e.ParentId, e.MessageDate, e.LastModifiedDate, e.LastModifiedById, e.IsDeleted, e.Incoming, e.Id, e.HtmlBody, e.Headers, e.HasAttachment, e.FromName, e.CreatedDate, e.CreatedById, e.CcAddress, e.BccAddress, e.ActivityId From EmailMessage e ' + wheretext + ' order by ' + sortFullExp + ' limit 1000');
       return null;
   }
}
</pre>
<p>And here's the Visualforce Page:</p>
<pre class="brush: xml;">
&lt;apex:page controller=&quot;EmailMessageController&quot; action=&quot;{!ViewData}&quot;&gt;
	&lt;apex:sectionHeader title=&quot;Email Messages&quot; subtitle=&quot;&quot;&gt;&lt;/apex:sectionHeader&gt;
	&lt;apex:pageblock id=&quot;emailblock&quot;&gt;
		&lt;apex:facet name=&quot;header&quot;&gt;
			&lt;apex:form&gt;
				&lt;apex:panelGrid styleClass=&quot;list&quot;
					columnClasses=&quot;pbTitle,pbButton,pbHelp&quot; columns=&quot;3&quot; border=&quot;0&quot;
					cellpadding=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
					&lt;apex:outputLabel&gt;&lt;h3&gt;Messages&lt;/h3&gt;&lt;/apex:outputLabel&gt;
					&lt;apex:commandButton value=&quot; Refresh &quot; styleClass=&quot;btn&quot;
						action=&quot;{!ViewData}&quot; rerender=&quot;emailblock&quot;&gt;&lt;/apex:commandButton&gt;
					&lt;apex:SelectList value=&quot;{!wheretext}&quot; size=&quot;1&quot;	id=&quot;controllerselectlist&quot;&gt;
						&lt;apex:actionSupport event=&quot;onchange&quot; action=&quot;{!ViewData}&quot;
							reRender=&quot;emailblock&quot;&gt;&lt;/apex:actionSupport&gt;
						&lt;apex:selectOptions value=&quot;{!views}&quot; /&gt;
					&lt;/apex:SelectList&gt;
				&lt;/apex:panelGrid&gt;
			&lt;/apex:form&gt;
		&lt;/apex:facet&gt;
		&lt;apex:form&gt;
			&lt;apex:pageblocktable value=&quot;{!Messages}&quot; var=&quot;e&quot; id=&quot;emailtable&quot;
				bgcolor=&quot;#F3F3EC&quot; styleClass=&quot;list&quot; rowClasses=&quot;dataRow&quot;
				onRowMouseOver=&quot;hiOn(this);&quot; onRowMouseOut=&quot;hiOff(this);&quot;&gt;
				&lt;apex:column&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
						&lt;apex:commandLink action=&quot;{!ViewData}&quot;
							value=&quot;{!$ObjectType.EmailMessage.fields.Subject.label}{!IF(sortExpression=='Subject', 
							IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
							&lt;apex:param value=&quot;Subject&quot; name=&quot;column&quot;
								assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
						&lt;/apex:commandLink&gt;
					&lt;/apex:facet&gt;
					&lt;apex:outputLink value=&quot;/{!e.Id}&quot; target=&quot;_blank&quot;&gt;{!e.Subject}&lt;/apex:outputLink&gt;
				&lt;/apex:column&gt;
				&lt;apex:column&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
					{!$ObjectType.Contact.fields.Name.label}
					&lt;/apex:facet&gt;
					&lt;apex:outputLink value=&quot;/{!e.Parent.ContactId}&quot; target=&quot;_blank&quot;
						rendered=&quot;{!IF(e.Parent.ContactId != '',true,false)}&quot;&gt;{!e.FromName}&lt;/apex:outputLink&gt;
					&lt;apex:outputtext value=&quot;{!e.FromName}&quot;
						rendered=&quot;{!IF(e.Parent.ContactId != '',false,true)}&quot; /&gt;
				&lt;/apex:column&gt;
				&lt;apex:column&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
					{!$ObjectType.Account.fields.Name.label}
					&lt;/apex:facet&gt;
					&lt;apex:outputLink value=&quot;/{!e.Parent.AccountId}&quot; target=&quot;_blank&quot;&gt;{!e.Parent.Account.Name}&lt;/apex:outputLink&gt;
				&lt;/apex:column&gt;
				&lt;apex:column value=&quot;{!e.FromAddress}&quot;&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
						&lt;apex:commandLink action=&quot;{!ViewData}&quot;
							value=&quot;{!$ObjectType.EmailMessage.fields.FromAddress.label}{!IF(sortExpression=='FromAddress', 
							IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
							&lt;apex:param value=&quot;FromAddress&quot; name=&quot;column&quot;
								assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
						&lt;/apex:commandLink&gt;
					&lt;/apex:facet&gt;
				&lt;/apex:column&gt;
				&lt;apex:column value=&quot;{!e.Status}&quot;&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
						&lt;apex:commandLink action=&quot;{!ViewData}&quot;
							value=&quot;{!$ObjectType.EmailMessage.fields.Status.label}{!IF(sortExpression=='Status', 
							IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
							&lt;apex:param value=&quot;Status&quot; name=&quot;column&quot;
								assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
						&lt;/apex:commandLink&gt;
					&lt;/apex:facet&gt;
				&lt;/apex:column&gt;
				&lt;apex:column value=&quot;{!e.MessageDate}&quot;&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
						&lt;apex:commandLink action=&quot;{!ViewData}&quot;
							value=&quot;{!$ObjectType.EmailMessage.fields.MessageDate.label}{!IF(sortExpression=='MessageDate', 
							IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
							&lt;apex:param value=&quot;MessageDate&quot; name=&quot;column&quot;
								assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
						&lt;/apex:commandLink&gt;
					&lt;/apex:facet&gt;
				&lt;/apex:column&gt;
				&lt;apex:column value=&quot;{!e.Incoming}&quot;&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
						&lt;apex:commandLink action=&quot;{!ViewData}&quot;
							value=&quot;{!$ObjectType.EmailMessage.fields.Incoming.label}{!IF(sortExpression=='Incoming', 
							IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
							&lt;apex:param value=&quot;Incoming&quot; name=&quot;column&quot;
								assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
						&lt;/apex:commandLink&gt;
					&lt;/apex:facet&gt;
				&lt;/apex:column&gt;
				&lt;apex:column value=&quot;{!e.HasAttachment}&quot;&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
						&lt;apex:commandLink action=&quot;{!ViewData}&quot;
							value=&quot;{!$ObjectType.EmailMessage.fields.HasAttachment.label}{!IF(sortExpression=='HasAttachment', 
							IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
							&lt;apex:param value=&quot;HasAttachment&quot; name=&quot;column&quot;
								assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
						&lt;/apex:commandLink&gt;
					&lt;/apex:facet&gt;
				&lt;/apex:column&gt;
				&lt;apex:column&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
						&lt;apex:commandLink action=&quot;{!ViewData}&quot;
							value=&quot;{!$ObjectType.Case.fields.CaseNumber.label}{!IF(sortExpression=='ParentId', 
							IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
							&lt;apex:param value=&quot;ParentId&quot; name=&quot;column&quot;
								assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
						&lt;/apex:commandLink&gt;
					&lt;/apex:facet&gt;
					&lt;apex:outputLink value=&quot;/{!e.ParentId}&quot;&gt;{!e.Parent.CaseNumber}&lt;/apex:outputLink&gt;

				&lt;/apex:column&gt;
				&lt;apex:column value=&quot;{!e.ToAddress}&quot;&gt;
					&lt;apex:facet name=&quot;header&quot;&gt;
						&lt;apex:commandLink action=&quot;{!ViewData}&quot;
							value=&quot;{!$ObjectType.EmailMessage.fields.ToAddress.label}{!IF(sortExpression=='ToAddress', 
							IF(sortDirection='ASC','▼','▲'),'')}&quot;&gt;
							&lt;apex:param value=&quot;ToAddress&quot; name=&quot;column&quot;
								assignTo=&quot;{!sortExpression}&quot;&gt;&lt;/apex:param&gt;
						&lt;/apex:commandLink&gt;
					&lt;/apex:facet&gt;
				&lt;/apex:column&gt;
			&lt;/apex:pageblocktable&gt;
		&lt;/apex:form&gt;
	&lt;/apex:pageblock&gt;
&lt;/apex:page&gt;
</pre>
<p>There are some other cool bits: </p>
<p>If there is no Case.Contact, the table will display the FromName, pulled from the email message.</p>
<p>An interesting point: You may notice that EmailStatus is presented in numerical form.  For instance, Incoming Unread is 0, Incoming Read is 1, etc.  The documentation, however, says, "Read only. The status of the email. For example, “New,” “Unread,” “Replied,” “Sent.”"  So we're not sure of the exact mapping.  3 seems to be Sent, so 2 is probably Replied... but we're not sure.</p>
<p>Don't forget: EmailMessage has two lookups (foreign key): Case, and Activity.  This Activity is the task created when Salesforce receives the email, and is - according to the documentation - assigned to the Case Owner.  We're not sure what happens when the Case is owned by a Queue.  Feel free to comment and share your experiences.</p>
<p>
That's it!  Enjoy.</p>]]></content:encoded>
			<wfw:commentRss>http://www.x2od.com/2009/07/14/visualforce-email-inbox.html/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Checkbox Formula Field in Visualforce</title>
		<link>http://www.x2od.com/2009/05/21/checkbox-formula-field-in-visualforce.html</link>
		<comments>http://www.x2od.com/2009/05/21/checkbox-formula-field-in-visualforce.html#comments</comments>
		<pubDate>Thu, 21 May 2009 17:00:52 +0000</pubDate>
		<dc:creator>David Schach</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[salesforce.com]]></category>

		<guid isPermaLink="false">http://www.x2od.com/?p=609</guid>
		<description><![CDATA[In keeping with the theme of checkboxes and formulas, we provide an easy way to create a checkbox formula field using Visualforce: the checkbox tag with the disabled attribute:]]></description>
			<content:encoded><![CDATA[<p>In keeping with the theme of <a href="http://www.x2od.com/2009/05/11/standard-checkbox-images.html">checkboxes</a> and formulas, we provide an easy way to create a checkbox formula field using Visualforce: the checkbox tag with the disabled attribute:</p>
<p>First, the Apex controller method:</p>
<pre class="brush: java;">
public boolean checkformula(){
boolean b = [insert formula here];
return b;
}
</pre>
<p>And the visualforce code:</p>
<pre class="brush: xml;">
&lt;apex:inputCheckbox disabled=&quot;true&quot; value=&quot;{!checkformula}&quot;/&gt;
</pre>
<p>That's it!  Of course, there are many ways to set up the Apex method, but the important piece is the Visualforce markup.  By using a tag usually associated with an edit page but making it disabled, the checkbox becomes an output field.</p>]]></content:encoded>
			<wfw:commentRss>http://www.x2od.com/2009/05/21/checkbox-formula-field-in-visualforce.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flexible Field Labels</title>
		<link>http://www.x2od.com/2009/03/23/flexible-field-labels.html</link>
		<comments>http://www.x2od.com/2009/03/23/flexible-field-labels.html#comments</comments>
		<pubDate>Mon, 23 Mar 2009 21:02:46 +0000</pubDate>
		<dc:creator>David Schach</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Native Application]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[salesforce.com]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[Force.com Platform]]></category>

		<guid isPermaLink="false">http://www.x2od.com/?p=439</guid>
		<description><![CDATA[While making a Visualforce page to display a Zip/Country -> City, State, County application, it became obvious that labeling fields manually will not satisfy all users, especially international ones. There are a few ways to include a field and its label on a Visualforce page. The simplest, using OutputField: VF Page (simple): &#60;apex:page standardcontroller=&#34;Account&#34;&#62; &#60;apex:pageblock&#62; [...]]]></description>
			<content:encoded><![CDATA[While making a Visualforce page to display a Zip/Country -> City, State, County application, it became obvious that labeling fields manually will not satisfy all users, especially international ones.  

There are a few ways to include a field and its label on a Visualforce page.  

<span id="more-439"></span>
<p>The simplest, using OutputField:<br>
<strong>VF Page (simple):</strong>
<pre class="brush: xml;">
&lt;apex:page standardcontroller=&quot;Account&quot;&gt;
&lt;apex:pageblock&gt;
&lt;apex:pageblocksection&gt;
&lt;apex:outputField value=&quot;{!Account.Name}&quot; /&gt;
&lt;/apex:pageblocksection&gt;
&lt;/apex:pageblock&gt;
&lt;/apex:page&gt;
</pre>

<a href="http://www.x2od.com/2009/03/23/flexible-field-labels.html/code1" rel="attachment wp-att-451"><img src="http://www.x2od.com/wp/uploads/code1.png" alt="code1" title="code1" width="386" height="57" class="aligncenter size-full wp-image-451" /></a><p><p>

The most common (based on code shares and other observations) method allows one to use a label other than the one in Salesforce.  It also allows combining of multiple fields while maintaining the standard style:<br>
<strong>VF Page (common, but static):</strong>
<pre class="brush: xml;">
&lt;apex:page standardcontroller=&quot;Account&quot;&gt;
&lt;apex:pageblock&gt;
&lt;apex:pageblocksection columns=&quot;1&quot;&gt;
&lt;apex:pageblocksectionitem&gt;
&lt;apex:outputLabel value=&quot;Account Name&quot; for=&quot;an&quot; /&gt;
&lt;apex:outputText value=&quot;{!Account.Name}&quot; id=&quot;an&quot; /&gt;
&lt;/apex:pageblocksectionitem&gt;
&lt;apex:pageblocksectionitem&gt;
&lt;apex:outputLabel value=&quot;City, State, Zip&quot; for=&quot;csz&quot; /&gt;
&lt;apex:outputText value=&quot;{!Account.BillingCity}, {!Account.BillingState} {!Account.BillingPostalCode}&quot; /&gt;
&lt;/apex:pageblocksectionitem&gt;
&lt;/apex:pageblocksection&gt;
&lt;/apex:pageblock&gt;
&lt;/apex:page&gt;
</pre>

<a href="http://www.x2od.com/2009/03/23/flexible-field-labels.html/code2" rel="attachment wp-att-450"><img src="http://www.x2od.com/wp/uploads/code2.png" alt="code2" title="code2" width="401" height="99" class="aligncenter size-full wp-image-450" /></a><p><p>

And a way to allow field label renaming and translations:<br>
<strong>VF Page (more flexible, allowing for renaming and translations):</strong>
<pre class="brush: xml;">
&lt;apex:page standardcontroller=&quot;Account&quot;&gt;
&lt;apex:pageblock&gt;
&lt;apex:pageblocksection columns=&quot;1&quot;&gt;
&lt;apex:pageblocksectionitem&gt;
&lt;apex:outputLabel value=&quot;{!$ObjectType.account.fields.name.label}&quot;  for=&quot;an&quot; /&gt;
&lt;apex:outputText value=&quot;{!Account.Name}&quot; id=&quot;an&quot; /&gt;
&lt;/apex:pageblocksectionitem&gt;
&lt;apex:pageblocksectionitem&gt;
&lt;apex:outputLabel value=&quot;{!$ObjectType.account.fields.billingcity.label}, {!$ObjectType.account.fields.billingstate.label}, {!$ObjectType.account.fields.billingpostalcode.label}&quot; for=&quot;csz&quot; /&gt;
&lt;apex:outputText value=&quot;{!Account.BillingCity}, {!Account.BillingState} {!Account.BillingPostalCode}&quot; id=&quot;csz&quot;/&gt;
&lt;/apex:pageblocksectionitem&gt;
&lt;/apex:pageblocksection&gt;
&lt;/apex:pageblock&gt;
&lt;/apex:page&gt;
</pre>

<a href="http://www.x2od.com/2009/03/23/flexible-field-labels.html/code3" rel="attachment wp-att-449"><img src="http://www.x2od.com/wp/uploads/code3.png" alt="code3" title="code3" width="413" height="106" class="aligncenter size-full wp-image-449" /></a><p><p><p>
So by using <strong>$ObjectType.account.fields.billingcity.label</strong> (and similar markup for other objects and fields) we can allow org-specific customizations to come into our code with no effort required.
<p>
There's a catch (there always is).  Note that there is no way to combine the three fields for City, State, and Zip (while using automatic renaming to help us with any customizations that the org has made) while maintaining proper labeling.  In this case, the label for the combined field would be "<strong>Billing City, Billing State, Billing Zip/PostalCode</strong>."  In other words, we can use whatever the org prefers for each field, but the developer must choose the label, which must remain static.<p>
The more astute administrators and developers will note that there is a solution available: Use a component and pass the field labels displayed to the component.  Then, using custom labels and translations, the component could be made truly international.  This is, however, beyond the scope of this post.  But it is an idea for a future post...<p>
And the most astute amongst you are probably saying, "A truly flexible labeling system would allow the word "State" for a US address, "Province" for Canadian and others, and would still be completely customizable and translatable.  Yes, that would be nice.  :)]]></content:encoded>
			<wfw:commentRss>http://www.x2od.com/2009/03/23/flexible-field-labels.html/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Ultimate Visualforce Events Tab &#8211; Almost</title>
		<link>http://www.x2od.com/2009/01/05/the-ultimate-visualforce-events-tab-almos.html</link>
		<comments>http://www.x2od.com/2009/01/05/the-ultimate-visualforce-events-tab-almos.html#comments</comments>
		<pubDate>Mon, 05 Jan 2009 16:35:56 +0000</pubDate>
		<dc:creator>David Schach</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[Winter 09]]></category>
		<category><![CDATA[salesforce.com]]></category>
		<category><![CDATA[Apex]]></category>
		<category><![CDATA[Force.com Builder]]></category>
		<category><![CDATA[Force.com Platform]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.x2od.com/?p=217</guid>
		<description><![CDATA[Check old blog posts, and you&#8217;ll see that I&#8217;ve been working on custom Events and Task tabs for a while now. A Task Visualforce tab (that mimics the Task box on the Home Page) is almost ready to come out, but the Events Enhanced List tab is (pretty much) here! This bears emphasizing: Enhanced Lists [...]]]></description>
			<content:encoded><![CDATA[Check old blog posts, and you&#8217;ll see that I&#8217;ve been working on custom Events and Task tabs for a while now.  A Task Visualforce tab (that mimics the Task box on the Home Page) is almost ready to come out, but the Events Enhanced List tab is (pretty much) here!<p>
This bears emphasizing: Enhanced Lists were initially not fully released for Activity/Event/Task objects, but are available now.  <p>
The code is ridiculously simple, thanks to the apex:EnhancedList Visualforce tag:
<pre class="brush: xml;">
&lt;apex:page standardController=&quot;Task&quot; &gt;
&lt;apex:enhancedList type=&quot;Activity&quot; height=&quot;800&quot; rowsPerPage=&quot;50&quot; /&gt;
&lt;/apex:page&gt;
</pre>

See?  Nothing to it!   Or so we thought.  There are some catches (there always are):<p>

<ol>
	<li>The original use-case required displaying all upcoming events without the header or sidebar.  We still cannot do this.  Quoting from the Winter &#8217;09 Release Notes: <em>The enhancedList component is not allowed on pages that have the attribute showHeader set to false.</em></li>
	<li>We&#8217;d like to create a custom tab for this page.  We create a Visualforce Tab, pick a custom icon, and show the page&#8230; and when I click on the tab, the enhanced list is displayed, but the tab is not highlighted.  Also, the custom icon I chose is not displayed.  How do we highlight our tab?<br />
After making the page, we make the tab as desribed above.  Then we RETURN to the page and add a tabstyle modifier to the apex:page tag, like so:

<pre class="brush: xml;">
&lt;apex:page standardController=&quot;Task&quot; tabstyle=&quot;enhanced_activities__tab&quot;&gt;
&lt;apex:enhancedList type=&quot;Activity&quot; height=&quot;800&quot; rowsPerPage=&quot;50&quot; /&gt;
&lt;/apex:page&gt;
</pre>
[Of course, change the tab name to whatever you choose.]<p>

Success?  Not quite.  There&#8217;s another catch:

</li>
	<li>The tab is highlighted (brown in our case), but the color and icon for the enhanced list are standard green/home.  <br />

Sadly, I have no workaround for this one. Sorry.</li>
</ol>

To repeat: Enhanced lists were not initially fully available for Events and Tasks, but now do support them.  <p>

Moving forward, consider if you want to create a particular enhanced list view instead of calling the standard enhanced Activity list as I have done here.  If you would prefer to make a custom enhanced list view, then you will need to add more code, but that is beyond the scope of this post.<p>

Enjoy!]]></content:encoded>
			<wfw:commentRss>http://www.x2od.com/2009/01/05/the-ultimate-visualforce-events-tab-almos.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Project: Change Owner Button in Visualforce</title>
		<link>http://www.x2od.com/2008/11/13/project-change-owner-button-in-visualforce.html</link>
		<comments>http://www.x2od.com/2008/11/13/project-change-owner-button-in-visualforce.html#comments</comments>
		<pubDate>Thu, 13 Nov 2008 06:13:15 +0000</pubDate>
		<dc:creator>David Schach</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[X-Squared On Demand]]></category>
		<category><![CDATA[salesforce.com]]></category>
		<category><![CDATA[Projects]]></category>

		<guid isPermaLink="false">http://www.x2od.com/?p=244</guid>
		<description><![CDATA[Drawing upon some code I found in the Developers Guide, I have written a Visualforce page to mass-change the owner of all selected records to any active User in Salesforce.  Yes, it only works with Contacts for now, but my next step will be to use Dynamic Apex to pass the sObject name to the page and its extension/controller, allowing me to reuse one bit of code for multiple objects.  We'll see how it goes.  But in the meantime, enjoy this page that lets you perform a search, check which records you want to transfer, and then input a User.  I've tested it with 50 records at once, so that should suffice for most uses.]]></description>
			<content:encoded><![CDATA[<p>Salesforce Labs has put out a series of Mass Action packages on the AppExchange.  There is <a href="https://www.salesforce.com/appexchange/detail_overview.jsp?NavCode__c=&#038;id=a0330000000iAkcAAE">Mass Transfer Opportunity Owner</a> (uses AJAX), <a href="http://www.salesforce.com/appexchange/detail_overview.jsp?NavCode__c=&#038;id=a0330000000iIEtAAM">Mass Update Contact Addresses</a> (AJAX), <a href="http://www.salesforce.com/appexchange/detail_overview.jsp?NavCode__c=&#038;id=a0330000000iAkcAAE">Mass Update Opportunity Owner</a>, <a href="https://www.salesforce.com/appexchange/detail_overview.jsp?NavCode__c=&#038;id=a0330000000iIAxAAM">Mass Update Opportunity Close Dates</a>, etc.  All of these are &#8220;thick client&#8221; tools, meaning that data must be loaded onto your computer, altered, and then uploaded back to Salesforce.  </p>
<p><a href="http://community.salesforce.com/sforce/tracker?user.id=198">Ron Hess</a> released a super bit of code, found in the Visualforce documentation and elsewhere, to <a href="http://www.salesforce.com/us/developer/docs/pages/Content/pages_controller_sosc_custom_button.htm">Mass Update Opportunity Stage and Close Date</a>.  It could, theoretically, be expanded to other fields as well.  This got me thinking about doing so with other objects.  </p>
<p>A while ago, I took the code for the <a href="http://www.salesforce.com/appexchange/detail_overview.jsp?NavCode__c=&#038;id=a03300000033CsnAAE">Mass Delete</a> button and altered it to change the owner of the selected records to the User clicking the button.  It was like an Accept button, but I could use it for any object.  Actually, it wasn&#8217;t as easy as that.  I had to make one button for each object, and maintenance was a pain&#8211;whenever I created a new object, I needed to clone my code.</p>
<p>Drawing upon some code I found in the <a href="http://wiki.apexdevnet.com/index.php/force_library">Developers Guide</a>, I have written a Visualforce page to mass-change the owner of all selected records to any active User in Salesforce.  Yes, it only works with Contacts for now, but my next step will be to use Dynamic Apex to pass the sObject name to the page and its extension/controller, allowing me to reuse one bit of code for multiple objects.  We&#8217;ll see how it goes.  But in the meantime, enjoy this page that lets you perform a search, check which records you want to transfer, and then input a User.  I&#8217;ve tested it with 50 records at once, so that should suffice for most uses.</p>
<p><strong>VF Page:</strong><br />
<pre class="brush: xml;">&lt;br /&gt;
&lt;apex:page standardController=&quot;Contact&quot; recordSetVar=&quot;Contacts&quot; id=&quot;updateOwnerPage&quot;&gt;&lt;br /&gt;
&lt;apex:form&gt;&lt;br /&gt;
&lt;apex:sectionHeader title=&quot;Change Owner for Contacts&quot;/&gt;&lt;br /&gt;
&lt;apex:pageBlock mode=&quot;edit&quot;&gt;&lt;br /&gt;
&lt;apex:pageMessages /&gt;&lt;br /&gt;
&lt;apex:pageblockSection title=&quot;Change&quot; columns=&quot;1&quot;&gt;&lt;br /&gt;
&lt;apex:pageblockSectionItem &gt;&lt;br /&gt;
&lt;apex:outputLabel for=&quot;owner&quot;&gt;New Owner&lt;/apex:outputLabel&gt;&lt;br /&gt;
&lt;apex:inputField id=&quot;owner&quot; value=&quot;{!Contact.OwnerId}&quot;/&gt;&lt;br /&gt;
&lt;/apex:pageblockSectionItem&gt;&lt;br /&gt;
&lt;/apex:pageBlockSection&gt;&lt;br /&gt;
&lt;apex:pageBlockSection title=&quot;Selected Contacts&quot; columns=&quot;1&quot;&gt;&lt;br /&gt;
&lt;apex:pageBlockTable value=&quot;{!selected}&quot; var=&quot;j&quot; bgcolor=&quot;#F3F3EC&quot; width=&quot;100%&quot;&lt;br /&gt;
styleClass=&amp;#8221;list&amp;#8221; rowClasses=&amp;#8221;dataRow&amp;#8221; onRowMouseOver=&amp;#8221;hiOn(this);&amp;#8221; onRowMouseOut=&amp;#8221;hiOff(this);&amp;#8221;&gt;&lt;br /&gt;
&lt;apex:column &gt;&lt;br /&gt;
&lt;apex:facet name=&quot;header&quot;&gt;Contact Name&lt;/apex:facet&gt;&lt;br /&gt;
&lt;apex:outputLink value=&quot;{!URLFOR($Action.Contact.View, j.id)}&quot;&gt;&lt;br /&gt;
{!j.FirstName} {!j.LastName}&lt;/apex:outputLink&gt;&lt;br /&gt;
&lt;/apex:column&gt;&lt;br /&gt;
&lt;apex:column &gt;&lt;br /&gt;
&lt;apex:facet name=&quot;header&quot;&gt;Account Name&lt;/apex:facet&gt;&lt;br /&gt;
&lt;apex:outputLink value=&quot;{!URLFOR($Action.Account.View, j.Account.id)}&quot;&gt;&lt;br /&gt;
{!j.Account.Name}&lt;/apex:outputLink&gt;&lt;br /&gt;
&lt;/apex:column&gt;&lt;br /&gt;
&lt;apex:column&gt;&lt;br /&gt;
&lt;apex:facet name=&quot;header&quot;&gt;Current Owner&lt;/apex:facet&gt;&lt;br /&gt;
{!j.Owner.Name}&lt;br /&gt;
&lt;/apex:column&gt;&lt;br /&gt;
&lt;/apex:pageBlockTable&gt;&lt;br /&gt;
&lt;/apex:pageblockSection&gt;&lt;br /&gt;
&lt;apex:pageBlockButtons location=&quot;bottom&quot;&gt;&lt;br /&gt;
&lt;apex:commandButton value=&quot;Save&quot; action=&quot;{!save}&quot;/&gt;&lt;br /&gt;
&lt;apex:commandButton value=&quot;Cancel&quot; action=&quot;{!cancel}&quot;/&gt;&lt;br /&gt;
&lt;/apex:pageBlockButtons&gt;&lt;br /&gt;
&lt;/apex:pageBlock&gt;&lt;br /&gt;
&lt;/apex:form&gt;&lt;br /&gt;
&lt;/apex:page&gt;&lt;br /&gt;
</pre></p>
<p><strong>Button:</strong><br />
Go to Setup -> Contact -> Buttons and Links<br />
Create a new button, set it to execute in the current window with sidebar and header, and set it to call a Visualforce page.  Select the page you just created.  Then add the button to Contact Search Layout and to any Contact related lists you like.</p>
<p>Voila!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.x2od.com/2008/11/13/project-change-owner-button-in-visualforce.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Project: Lookup to Picklist</title>
		<link>http://www.x2od.com/2008/11/11/project-lookup-to-picklist.html</link>
		<comments>http://www.x2od.com/2008/11/11/project-lookup-to-picklist.html#comments</comments>
		<pubDate>Tue, 11 Nov 2008 05:56:37 +0000</pubDate>
		<dc:creator>David Schach</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[salesforce.com]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Dreamforce]]></category>
		<category><![CDATA[Projects]]></category>
		<category><![CDATA[X-Squared On Demand]]></category>

		<guid isPermaLink="false">http://www.x2od.com/?p=232</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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 <a href="http://wiki.apexdevnet.com/index.php/force_library">Developers Guide</a> from the new post-Dreamforce Library.)</p>
<p>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.</p>
<p><strong>VF Page:</strong><br />
<pre class="brush: xml;">&lt;br /&gt;
&lt;apex:page standardcontroller=&quot;Child__c&quot; Extensions=&quot;ChildExtension&quot;&gt;&lt;br /&gt;
&lt;apex:messages &gt;&lt;/apex:messages&gt;&lt;br /&gt;
&lt;apex:form &gt;&lt;br /&gt;
&lt;apex:pageBlock mode=&quot;edit&quot; id=&quot;thePageBlock&quot;&gt;&lt;br /&gt;
&lt;apex:pageBlockButtons &gt;&lt;br /&gt;
&lt;apex:commandButton value=&quot;Save&quot; action=&quot;{!save}&quot;/&gt;&lt;br /&gt;
&lt;apex:commandButton value=&quot;Cancel&quot; action=&quot;{!cancel}&quot;/&gt;&lt;br /&gt;
&lt;/apex:pageBlockButtons&gt;&lt;br /&gt;
&lt;apex:pageblockSection id=&quot;ParentList&quot; title=&quot;1&quot;&gt;&lt;br /&gt;
&lt;apex:pageBlockSectionItem &gt;&lt;br /&gt;
&lt;apex:outputLabel value=&quot;Parent&quot; for=&quot;p&quot;/&gt;&lt;br /&gt;
&lt;apex:selectList id=&quot;p&quot; value=&quot;{!Child__c.Parent__c}&quot; size=&quot;1&quot; title=&quot;3&quot;&gt;&lt;br /&gt;
    &lt;apex:selectOptions value=&quot;{!ParentOptions}&quot;/&gt;&lt;br /&gt;
&lt;/apex:selectList&gt;&lt;br /&gt;
&lt;/apex:pageBlockSectionItem&gt;&lt;br /&gt;
&lt;/apex:pageblocksection&gt;&lt;br /&gt;
&lt;/apex:pageBlock&gt;&lt;br /&gt;
&lt;/apex:form&gt;&lt;br /&gt;
&lt;/apex:page&gt;&lt;br /&gt;
</pre></p>
<p><strong>Extension:</strong><br />
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.</p>
<p><pre class="brush: java;">&lt;br /&gt;
public class ChildExtension {&lt;/p&gt;
&lt;p&gt;private final Child__c child;&lt;/p&gt;
&lt;p&gt;    public ChildExtension(ApexPages.StandardController controller) {&lt;br /&gt;
        this.child = (Child__c)controller.getRecord();&lt;br /&gt;
        }&lt;/p&gt;
&lt;p&gt;    public List&lt;br /&gt;
&lt;selectOption&gt; PositionOptions {get&lt;br /&gt;
        {&lt;br /&gt;
        List&lt;br /&gt;
&lt;selectOption&gt; parents = new List&lt;br /&gt;
&lt;selectOption&gt;();&lt;br /&gt;
        for (Parent__c prt : [select name from Parent__c pt])&lt;br /&gt;
            parents.add(new selectOption(prt.id, prt.name));&lt;br /&gt;
            return parents;&lt;br /&gt;
        }&lt;br /&gt;
    private set;&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
</pre></p>
<p>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&#8217;s email address or anything else.  Try it out!  </p>
<p>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.</p>
<p>And because I put this in every post: There&#8217;s a catch.  (There always is.)  I&#8217;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.</p>
<p>On a separate note, I just had lunch with <a href="http://theenforcer.net">John Rotenstein aka The Enforcer</a>, who already put up a <a href="http://theenforcer.net/2008/11/x2od-the-enforcer/">photo</a> of our time in his office.  (I think the pirate logo was an accident, but it does add to my sinister persona, no?)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.x2od.com/2008/11/11/project-lookup-to-picklist.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
