<?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 &#187; salesforce</title>
	<atom:link href="http://joe-ferraro.com/tag/salesforce/feed/" rel="self" type="application/rss+xml" />
	<link>http://joe-ferraro.com</link>
	<description>adless since 2008</description>
	<lastBuildDate>Thu, 24 Mar 2011 22:22:57 +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>13</slash:comments>
		</item>
		<item>
		<title>system log trick</title>
		<link>http://joe-ferraro.com/2009/01/system-log-trick/</link>
		<comments>http://joe-ferraro.com/2009/01/system-log-trick/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 05:01:43 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[apex]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[linkedin]]></category>

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



If you&#8217;ve ever used the system log in Salesforce, surely you&#8217;ve run into some code formatting issues.  Fortunately, there&#8217;s a Firefox extension out there that will allow you to insert tabs in text areas.  Now, I can actually tell what I&#8217;m doing in the system log.


hth
]]></description>
			<content:encoded><![CDATA[<div>
	<img src="http://www.joe-ferraro.com/images/systemLogTabbed.png" alt="system log tabs" width="450" />
</div>
<div>
<p>
If you&#8217;ve ever used the system log in Salesforce, surely you&#8217;ve run into some code formatting issues.  Fortunately, there&#8217;s a <a href="https://addons.mozilla.org/en-US/firefox/addon/3955" target=new>Firefox extension out there</a> that will allow you to insert tabs in text areas.  Now, I can actually tell what I&#8217;m doing in the system log.
</p>
</div>
<p>hth</p>
]]></content:encoded>
			<wfw:commentRss>http://joe-ferraro.com/2009/01/system-log-trick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>running a trigger via workflow</title>
		<link>http://joe-ferraro.com/2008/08/running-a-trigger-via-workflow/</link>
		<comments>http://joe-ferraro.com/2008/08/running-a-trigger-via-workflow/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 20:55:09 +0000</pubDate>
		<dc:creator>joe</dc:creator>
				<category><![CDATA[apex]]></category>
		<category><![CDATA[salesforce]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://joe-ferraro.com/?p=38</guid>
		<description><![CDATA[Those of you who follow Steve Andersen&#8217;s blog may have seen his post re: cron jobs using Apex in April 2007.  Kudos to you, Steve for a fantastic post (better late than never!) not only because of its universal application, but also because it got me thinking of other roundabout ways of utilizing Apex.
Over [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone" src="http://www.joe-ferraro.com/images/apexLogo.png" alt="Apex" />Those of you who follow <a href="http://www.gokubi.com">Steve Andersen&#8217;s blog</a> may have seen his post re: <a href="http://gokubi.com/archives/daily-cron-jobs-with-apex">cron jobs using Apex</a> in April 2007.  Kudos to you, Steve for a fantastic post (better late than never!) not only because of its universal application, but also because it got me thinking of other roundabout ways of utilizing Apex.</p>
<p>Over the last several months, I&#8217;ve had several clients request that a record be checked for certain conditions after a certain amount of time has elapsed.  While the solution to this requirement may be intuitive to some of us seasoned Salesforce.com fanboys, I figured I&#8217;d walk through it for those new to the platform.</p>
<p><strong>Sample Requirement:</strong> After a Lead is inserted, wait three days, then check if any tasks have been associated with this record.  If not, send an email alert to the user&#8217;s manager.</p>
<p>First, we create a custom checkbox field on Leads called &#8220;Check for Activity&#8221;.  Then, create a workflow rule that runs when a Lead is inserted (add any additional filters if necessary).  Add to this workflow rule a time-based field update that runs three days after the Lead was inserted.  The field update will mark the &#8220;Check for Activity&#8221; checkbox &#8220;TRUE&#8221;.  Then, we create an Apex trigger that runs After Update on Leads:</p>
<pre name="code" class="php">

trigger checkForLeadActivity on Lead (after update) {
	for (Lead l : trigger.new) {
		if (l.check_for_activity__c == true) {
			//run our code
		}
	}
}
</pre>
<p>Obviously, I&#8217;ve left you high and dry on the code, but if you need more assistance feel free to reach out to me and I&#8217;d be happy to walk you through the code.</p>
<p>Happy Apex-ing!</p>
<p>*<strong>EDIT</strong><br />
I want to make sure I stress the importance of coding your triggers for bulk processing.  The code block above should <em>actually</em> read like so:</p>
<pre name="code" class="java">

trigger checkForLeadActivity on Lead (after update) {
	Lead[] leads = new Lead[]{};
	for (Lead l : trigger.new) {
		if (l.check_for_activity__c == true) {
			leads.add(l);
		}
	}

	//process leads outside the for loop
	//to avoid governor limits on things like SOQL queries
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://joe-ferraro.com/2008/08/running-a-trigger-via-workflow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

