<?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>joe-ferraro.com</title>
	<atom:link href="http://joe-ferraro.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://joe-ferraro.com</link>
	<description>adless since 2008</description>
	<lastBuildDate>Tue, 02 Mar 2010 18:56:29 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Live Twitter Gadget For Accounts</title>
		<link>http://joe-ferraro.com/2010/02/live-twitter-gadget-for-accounts/</link>
		<comments>http://joe-ferraro.com/2010/02/live-twitter-gadget-for-accounts/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 00:27:05 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[salesforce]]></category>
		<category><![CDATA[appexchange]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://joe-ferraro.com/?p=68</guid>
		<description><![CDATA[Wow, it&#8217;s been quite a while, but I&#8217;m finally back to let you know about a new app from Mavens on the Salesforce.com AppExchange.  &#8220;Live Twitter Gadget For Accounts&#8221; is a nifty Salesforce/Twitter mashup that does not require a Twitter account.  In a nutshell, it allows you to set keywords on your Salesforce [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, it&#8217;s been quite a while, but I&#8217;m finally back to let you know about a new app from <a href="http://www.mavensconsulting.com">Mavens</a> on the Salesforce.com AppExchange.  &#8220;<a href="https://sites.secure.force.com/appexchange/listingDetail?listingId=a0N300000023Nd6EAE" target=new>Live Twitter Gadget For Accounts</a>&#8221; is a nifty Salesforce/Twitter mashup that does not require a Twitter account.  In a nutshell, it allows you to set keywords on your Salesforce accounts that will drive related Tweets to your Account&#8217;s detail page, in real time.  This application was inspired by the functionality delivered by Google&#8217;s live results feature.</p>
<div>
<img src="http://joe-ferraro.com/images/liveTwitter.png"/>
</div>
<div style="margin-top:20px;">
<p><b>Installation screencast:</b></p>
<p><object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,115,0' width='560' height='345'><param name='movie' value='http://screenr.com/Content/assets/screenr_1116090935.swf' /><param name='flashvars' value='i=45449' /><param name='allowFullScreen' value='true' /><embed src='http://screenr.com/Content/assets/screenr_1116090935.swf' flashvars='i=45449' allowFullScreen='true' width='560' height='345' pluginspage='http://www.macromedia.com/go/getflashplayer'></embed></object>
</div>
]]></content:encoded>
			<wfw:commentRss>http://joe-ferraro.com/2010/02/live-twitter-gadget-for-accounts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>lookup &#8211;&gt; picklist</title>
		<link>http://joe-ferraro.com/2009/06/lookup-picklist/</link>
		<comments>http://joe-ferraro.com/2009/06/lookup-picklist/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 19:47:14 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[apex]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[visualforce]]></category>
		<category><![CDATA[lookup relationship]]></category>
		<category><![CDATA[picklist]]></category>

		<guid isPermaLink="false">http://joe-ferraro.com/?p=67</guid>
		<description><![CDATA[I've had several clients "voice concerns" about Salesforce.com's lookup functionality relative to user acceptance. Well, if you're dealing with a relatively simple lookup table, you can override an object's new/edit page with a Visualforce page and display the lookup field to the user as a picklist.]]></description>
			<content:encoded><![CDATA[<div style="padding: 5px; margin-bottom: 10px;"><img src="http://joe-ferraro.com/images/lookupToPicklist.png" alt="" /></div>
<p>I&#8217;ve had several clients &#8220;voice concerns&#8221; about Salesforce.com&#8217;s lookup functionality relative to user acceptance.  Well, if you&#8217;re dealing with a relatively simple lookup table, you can override an object&#8217;s new/edit page with a Visualforce page and display the lookup field to the user as a picklist.</p>
<p>In the [live Visualforce] example below, the user is creating a new &#8220;Some_Object__c&#8221; record.  The Some_Object__c object is very simple: it&#8217;s comprised of a standard name field and a custom lookup to another table called &#8220;Location__c&#8221;.  Location__c is comprised of name, city, and state fields and there are only 8 rows in the table.  Rather than having the user click the magnifying glass icon to lookup to the Location__c table, one can quite easily display a list of possible values to the user along with any other pertinent information (in this case, I&#8217;m displaying Location__c&#8217;s City__c and State__c fields as well).</p>
<div style="margin-top: 60px;">
 <IFRAME src="https://crmmanager-developer-edition.na6.force.com/test/NewObject" height="300" width="650" frameborder="0" scrolling="no" ></IFRAME>
</div>
<pre name="code" class="java">

public class SomeObjectExtension {
	private final ApexPages.standardController controller;
	private final Some_Object__c obj;

	public SomeObjectExtension(ApexPages.StandardController stdController) {
		this.controller = stdController;
		this.obj = (Some_Object__c)stdController.getRecord();
	}

	public SelectOption[] getLocationOptions() {
		SelectOption[] locations = new SelectOption[]{};
		locations.add(new SelectOption(&#039;&#039;,&#039;--None--&#039;));
		for (Location__c l : [select id, name, city__c, state__c from location__c where isdeleted = false order by name]) {
			locations.add(new SelectOption(l.id, l.name + &#039; (&#039; + l.city__c + &#039;, &#039; + l.state__c + &#039;)&#039;));
		}
		return locations;
	}
}
</pre>
<pre name="code" class="java">

&lt;apex:page standardController=&quot;Some_Object__c&quot; extensions=&quot;SomeObjectExtension&quot; showHeader=&quot;false&quot; &gt;
&lt;apex:sectionHeader title=&quot;Some Object Edit&quot; subtitle=&quot;New Some Object&quot; /&gt;
&lt;apex:form id=&quot;someObjectForm&quot;&gt;
&lt;apex:pageBlock title=&quot;Some Object Edit&quot; mode=&quot;edit&quot;&gt;
&lt;apex:pageBlockButtons &gt;
&lt;apex:commandButton action=&quot;{!save}&quot; value=&quot;Save&quot;/&gt;
&lt;/apex:pageBlockButtons&gt;
&lt;apex:pageBlockSection title=&quot;Some Object Information&quot; columns=&quot;1&quot;&gt;
&lt;apex:inputField value=&quot;{!Some_Object__c.Name}&quot; required=&quot;true&quot;/&gt;
&lt;apex:pageBlockSectionItem &gt;
&lt;apex:outputLabel value=&quot;{!$ObjectType.Some_Object__c.fields.Location__c.label}&quot; for=&quot;pLabel&quot;/&gt;
&lt;apex:outputPanel styleClass=&quot;requiredInput&quot; layout=&quot;block&quot;&gt;
&lt;apex:outputPanel styleClass=&quot;requiredBlock&quot; layout=&quot;block&quot;/&gt;
&lt;apex:actionRegion &gt;
&lt;apex:selectList id=&quot;locationLookupPicklist&quot; value=&quot;{!Some_Object__c.Location__c}&quot; size=&quot;1&quot; rendered=&quot;true&quot;&gt;
&lt;apex:selectOptions value=&quot;{!locationOptions}&quot;/&gt;
&lt;/apex:selectList&gt;
&lt;/apex:actionRegion&gt;
&lt;/apex:outputPanel&gt;
&lt;/apex:pageBlockSectionItem&gt;
&lt;/apex:pageBlockSection&gt;
&lt;/apex:pageBlock&gt;
&lt;/apex:form&gt;
&lt;/apex:page&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://joe-ferraro.com/2009/06/lookup-picklist/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>extjs &amp; visualforce (part 2), JSON this time</title>
		<link>http://joe-ferraro.com/2009/04/extjs-vf-json/</link>
		<comments>http://joe-ferraro.com/2009/04/extjs-vf-json/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 14:45:14 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[apex]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[visualforce]]></category>
		<category><![CDATA[extjs]]></category>

		<guid isPermaLink="false">http://joe-ferraro.com/?p=65</guid>
		<description><![CDATA[Let me preface this post by stating that the following is merely a proof of concept and should not necessarily be implemented into a production org.  The pagination demonstrated below is not fit for large datasets and may result in unexpected behavior!  
Rich Waters&#8217; comment on my first post re: Ext JS &#038; [...]]]></description>
			<content:encoded><![CDATA[<p>Let me preface this post by stating that the following is merely a <em>proof of concept</em> and <u>should not</u> necessarily be implemented into a production org.  The pagination demonstrated below is not fit for large datasets and may result in unexpected behavior!  </p>
<p><a href="http://joe-ferraro.com/2009/04/extjs-visualforce/#comment-1164" target=new>Rich Waters&#8217; comment</a> on my <a href="http://joe-ferraro.com/2009/04/extjs-visualforce/" target=new>first post re: Ext JS &#038; visualforce</a> got me thinking about the possibilities of leveraging JSON in Ext JS components within Visualforce, so I implemented a paging grid, similar to <a href="http://extjs.com/deploy/dev/examples/grid/paging.html" target=new>this example provided by Ext JS</a>.  OK, enough of the formalities, I suppose people want to see what kind of development ensued:</p>
<p>First, the product, a JSON-based Ext JS paging grid:</p>
<div>
 <IFRAME src="http://crmmanager-developer-edition.na6.force.com/test/ExtJs_Json_Grid" height="400" width="650" frameborder="0" scrolling="no" ></IFRAME>
</div>
<p>Now, for the magic behind the grid, the JSON file (a Visualforce page called &#8220;Json_test&#8221;):</p>
<pre name="code" class="java">

&lt;apex:page contentType=&quot;text/html&quot; showHeader=&quot;false&quot; controller=&quot;Json_File&quot; &gt;
	&lt;apex:outputText value=&quot;{!json}&quot; /&gt;
&lt;/apex:page&gt;
</pre>
<p>The controller (spits out the JSON):</p>
<pre name="code" class="java">

public class Json_File {

	public string json {get;set;}

	public Json_File() {
        opportunity[] opps = new opportunity[]{};

	integer start = 0;
	integer pageSize = 10;

	if (ApexPages.currentPage().getParameters().get(&#039;start&#039;) != null &amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp; ApexPages.currentPage().getParameters().get(&#039;limit&#039;) != null) {
		start = integer.valueof(ApexPages.currentPage().getParameters().get(&#039;start&#039;));
		pageSize = integer.valueof(ApexPages.currentPage().getParameters().get(&#039;limit&#039;));
	}

        string jsonRecordsString = &#039;&#039;;

        integer i = 1;
        integer j = 0;

        for (Opportunity o : [Select id, name, stagename, closedate from opportunity order by name limit 1000]) {
			if (j &gt;= start) {
				if (i &lt;= pageSize) {
					jsonRecordsString += &#039;{&#039;;
					jsonRecordsString += &#039;&quot;id&quot;:&#039; + &#039;&quot;&#039;+o.id+&#039;&quot;,&#039;;
					jsonRecordsString += &#039;&quot;name&quot;:&#039; + &#039;&quot;&#039;+o.name+&#039;&quot;,&#039;;
					jsonRecordsString += &#039;&quot;stagename&quot;:&#039; + &#039;&quot;&#039;+o.stagename+&#039;&quot;,&#039;;
					jsonRecordsString += &#039;&quot;closedate&quot;:&#039; + &#039;&quot;&#039;+o.closedate+&#039;&quot;&#039;;
					jsonRecordsString += &#039;},&#039;;
					i++;
				}
			}
			opps.add(o);
			j++;
        }

		string jsonString = &#039;({&quot;total&quot;:&quot;&#039;+opps.size()+&#039;&quot;, &quot;results&quot;:[&#039; + jsonRecordsString + &#039;]})&#039;;
        jsonString = jsonString.replaceAll(&#039;,]&#039;,&#039;]&#039;);
        this.json = jsonString;
	}
}
</pre>
<div style="margin-top:50px;">
<p>Finally, the grid itself (from the Visualforce page embedded above in this post):</p>
<p>*It&#8217;s important to note that this Visualforce page does not have a controller; the JsonStore provides the reference needed (url) [see below] to access the future backend of the grid.
</p></div>
<pre name="code" class="javascript">

&lt;script type=&quot;text/javascript&quot;&gt;
	var opportunity_grid;

	Ext.onReady(
		function() {
			//prevents mixed content message in ie
			Ext.BLANK_IMAGE_URL = &#039;/s.gif&#039;;
			Ext.SSL_SECURE_URL = &#039;/s.gif&#039;;
			render_queue();
		}
	);

	function render_queue() {
		// create the data store
		var store = new Ext.data.JsonStore({
			totalProperty: &#039;total&#039;,	// total data, see json output
			root: &#039;results&#039;,	// see json output
			url: &#039;http://crmmanager-developer-edition.na6.force.com/test/Json_test&#039;,
	        fields: [
	           {name: &#039;id&#039;},
	   			&#039;name&#039;, &#039;stagename&#039;, &#039;closedate&#039;
       		]
   		});

		var pagingBar = new Ext.PagingToolbar({
	        pageSize: 10,
	        store: store,
	        displayInfo: true,
	        displayMsg: &#039;Displaying opportunities {0} - {1} of {2}&#039;,
	        emptyMsg: &quot;No opportunities to display&quot;
	    });

		var gridView = new Ext.grid.GridView({
				forceFit: true
		}); 

	    opportunity_grid = new Ext.grid.GridPanel({
	        store: store,
	        columns: [
	            {header: &quot;name&quot;, width: 150, dataIndex: &#039;name&#039;, sortable: true},
	            {header: &quot;stage&quot;, width: 150, dataIndex: &#039;stagename&#039;, sortable: true},
	            {header: &quot;close date&quot;, width: 150, dataIndex: &#039;closedate&#039;, sortable: true}
	        ],
	        width:580,
	        height:300,
	        loadMask: true,
	        bbar: pagingBar,
	        view: gridView,
	        layout: &#039;fit&#039;
	    });
		try {
			opportunity_grid.render(&#039;opportunity_grid&#039;);
		} catch(e){}	

		store.load({params:{start:0, limit:10}});
	}
&lt;/script&gt;
</pre>
<p>As you can see, the Json_File controller accepts two params (start, pageSize), which are sent from the store in store.load() to manage the index of the query and the number of records returned.  Unfortunately, Salesforce does not provide an &#8220;INDEX&#8221; keyword in SOQL, which would make this pagination much more &#8220;resource respectful&#8221; (each time page up/page down is called from the paging grid, we receive a full dataset from Salesforce which, as you might guess, can be dangerous for tables with more than a thousand records).</p>
<p>I looked into the possibility of leveraging <a href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_pages_standardsetcontroller.htm">StandardSetController</a>, but given the out-of-box architecture of the paging grid, we&#8217;d still be calling our JSON controller each time the grid was &#8220;paged&#8221;, which effectively calls the entire dataset.</p>
<p>I&#8217;m open to ideas, so please weigh in.</p>
<p><span style="color:red;font-weight:bold;">EDIT: the source for the above example&#8230;</span><br />
<a href="http://joe-ferraro.com/blog-resources/ExtJs_Json_Grid.page">ExtJs_Json_Grid.page</a><br />
<a href="http://joe-ferraro.com/blog-resources/Json_Controller.cls">Json_Controller.cls</a><br />
<a href="http://joe-ferraro.com/blog-resources/Json_test.page">Json_test.page</a></p>
]]></content:encoded>
			<wfw:commentRss>http://joe-ferraro.com/2009/04/extjs-vf-json/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>extjs &amp; visualforce</title>
		<link>http://joe-ferraro.com/2009/04/extjs-visualforce/</link>
		<comments>http://joe-ferraro.com/2009/04/extjs-visualforce/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 15:20:59 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[salesforce]]></category>
		<category><![CDATA[visualforce]]></category>
		<category><![CDATA[extjs]]></category>
		<category><![CDATA[force.com sites]]></category>

		<guid isPermaLink="false">http://joe-ferraro.com/?p=64</guid>
		<description><![CDATA[
I&#8217;m interested to hear how people are utilizing extjs in their visualforce pages.  I&#8217;ve found it very helpful to use Apex to generate the store on the server side, then pass it along to the Visualforce page via a hidden input to be handled on the client side (rather than use the apex:repeat tags).
Note: [...]]]></description>
			<content:encoded><![CDATA[<p>
I&#8217;m interested to hear how people are utilizing extjs in their visualforce pages.  I&#8217;ve found it very helpful to use Apex to generate the store on the server side, then pass it along to the Visualforce page via a hidden input to be handled on the client side (rather than use the apex:repeat tags).</p>
<p>Note: once again, the grid below is a live Visualforce page from my developer Force.com site embedded into this post
</p>
<div>
 <IFRAME src="http://crmmanager-developer-edition.na6.force.com/test/ExtJs_Grid" height="400" width="650" frameborder="0" scrolling="no" ></IFRAME>
</div>
<pre name="code" class="java">

public class Grid_Controller {
	public string store {get;set;}
	public list&lt;QueueItem&gt; queueitems {get;set;}
	string userId = UserInfo.getUserId();

	public Grid_Controller() {
		queueitems = new queueitem[]{};
		for (Custom_Process_Instance__c cpi : [Select Owner.Name, Opportunity__r.Name, Opportunity__r.Id, (Select Id From Custom_Process_Instance_Step__r where Status__c != &#039;Completed&#039; AND Status__c = &#039;Pending&#039; limit 1), Percent_Complete__c, Process_Age__c from Custom_Process_Instance__c where Status__c = &#039;Pending&#039; AND Opportunity__c != null and IsDeleted = false order by CreatedDate asc]) {
            		QueueItem qi = new QueueItem(cpi);
            		queueitems.add(qi);
		}        

		string myDataString = &#039;var myData = [ &#039;;
		for(queueitem q : this.queueitems) {
			string showIcon = &#039;&#039;;
			if (q.ProcessInstance.Custom_Process_Instance_Step__r.size() == 1)
        			showIcon = &#039;yes&#039;;

			string oppId = q.ProcessInstance.Opportunity__c;
			string oppName = q.ProcessInstance.Opportunity__r.Name;
			string launchedby = q.ProcessInstance.Owner.Name;
			double percent = q.ProcessInstance.Percent_Complete__c;
			double ageInMinutes = q.ProcessInstance.Process_Age__c;

			if (q.ProcessInstance.Opportunity__r.Name != null)
				oppName = string.escapeSingleQuotes(q.ProcessInstance.Opportunity__r.Name);
			if (q.ProcessInstance.Owner.Name != null)
				launchedBy = string.escapeSingleQuotes(q.ProcessInstance.Owner.Name);

			myDataString += &#039;[\&#039;&#039;+showIcon+&#039;\&#039;,\&#039;&#039;+oppName+&#039;\&#039;, \&#039;&#039;+oppId+&#039;\&#039;,\&#039;&#039;+launchedBy+&#039;\&#039;,\&#039;&#039;+percent+&#039;\&#039;,\&#039;&#039;+ageInMinutes+&#039;\&#039;],&#039;;
		}

		myDataString += &#039;];&#039;;
		myDataString = myDataString.replace(&#039;,];&#039;, &#039;];&#039;);
		this.store = myDataString;
	}

	public class QueueItem {
		public Custom_Process_Instance__c ProcessInstance {get;set;}
		public QueueItem(Custom_Process_Instance__c cpi) {
			this.ProcessInstance = cpi;
		}
	}
}
</pre>
<pre name="code" class="java">

&lt;script type=&quot;text/javascript&quot;&gt;
	var myDataString = document.getElementById(&#039;{!$Component.myForm.dataStore}&#039;).value;
&lt;/script&gt;
</pre>
<pre name="code" class="java">

&lt;apex:form id=&quot;myForm&quot;&gt;
	&lt;apex:inputHidden value=&quot;{!store}&quot; id=&quot;dataStore&quot;/&gt;
&lt;/apex:form&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://joe-ferraro.com/2009/04/extjs-visualforce/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>imagine (better this time, i swear!)</title>
		<link>http://joe-ferraro.com/2009/03/imagine-better-this-time-i-swear/</link>
		<comments>http://joe-ferraro.com/2009/03/imagine-better-this-time-i-swear/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 16:58:35 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[piano]]></category>
		<category><![CDATA[imagine]]></category>
		<category><![CDATA[john lennon]]></category>

		<guid isPermaLink="false">http://joe-ferraro.com/?p=63</guid>
		<description><![CDATA[


ok i swear this time it&#8217;s better&#8230;
]]></description>
			<content:encoded><![CDATA[<div>
<img title="lennon" style="border:1px solid #ccc;" src="http://joe-ferraro.com/images/lennon_piano.jpg" alt="lennon playing piano" />
</div>
<p>ok i swear this time it&#8217;s better&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://joe-ferraro.com/2009/03/imagine-better-this-time-i-swear/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://joe-ferraro.com/piano/practice/imagine_04.mp3" length="1221194" type="audio/mpeg" />
		</item>
	</channel>
</rss>
