<?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>Force2b Technology Consultant</title>
	<atom:link href="http://www.force2b.net/index.php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.force2b.net</link>
	<description></description>
	<lastBuildDate>Fri, 10 Feb 2012 17:33:56 +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>My 15 Minutes</title>
		<link>http://www.force2b.net/index.php/2011/04/my-15-minutes/</link>
		<comments>http://www.force2b.net/index.php/2011/04/my-15-minutes/#comments</comments>
		<pubDate>Fri, 08 Apr 2011 18:38:23 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Salesforce.com]]></category>

		<guid isPermaLink="false">http://www.force2b.net/?p=427</guid>
		<description><![CDATA[Look Mom &#8211; There I am on the Dreamforce 2011 FAQ page. My wife thought this made me look like a politician.  A colleague said it reminded him of this commercial. Thanks to @apexsutherland for pointing it out to me.]]></description>
			<content:encoded><![CDATA[<p>Look Mom &#8211; There I am on the <a href="http://www.salesforce.com/dreamforce/DF11/about/faq/" target="_blank">Dreamforce 2011 FAQ</a> page.</p>
<p>My wife thought this made me look like a politician.  A colleague said it reminded him of this <a href="http://www.youtube.com/watch?v=QdNf9pvPfjI" target="_blank">commercial</a>.</p>
<p><a href="http://www.force2b.net/wp-content/uploads/2011/04/DreamForceFAQ-Page.jpg"><img class="aligncenter size-full wp-image-428" title="DreamForceFAQ Page" src="http://www.force2b.net/wp-content/uploads/2011/04/DreamForceFAQ-Page.jpg" alt="" width="764" height="429" /></a></p>
<p>Thanks to <a href="http://www.twitter.com/apexsutherland" target="_blank">@apexsutherland</a> for pointing it out to me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2011/04/my-15-minutes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What are you most looking forward to after Dreamforce</title>
		<link>http://www.force2b.net/index.php/2010/12/dreamforce-poll-4/</link>
		<comments>http://www.force2b.net/index.php/2010/12/dreamforce-poll-4/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 13:00:09 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Poll]]></category>
		<category><![CDATA[Salesforce.com]]></category>
		<category><![CDATA[Dreamforce]]></category>

		<guid isPermaLink="false">http://www.force2b.net/?p=399</guid>
		<description><![CDATA[After a long week and extremely production week in San Francisco, what you are most looking forward to do when you get back home? What are you most looking forward to after Dreamforcesurvey software]]></description>
			<content:encoded><![CDATA[<h3><span style="color: #000000;">After a long week and extremely production week in San Francisco, what you are most looking forward to do when you get back home?</span></h3>
<p><script src="http://static.polldaddy.com/p/4096771.js" type="text/javascript"></script><br />
<noscript><br />
<a href="http://polldaddy.com/poll/4096771/">What are you most looking forward to after Dreamforce</a><span style="font-size:9px;"><a href="http://polldaddy.com/features-surveys/">survey software</a></span><br />
</noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2010/12/dreamforce-poll-4/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Pre-Dreamforce 2010 Poll</title>
		<link>http://www.force2b.net/index.php/2010/12/dreamforce-poll-1/</link>
		<comments>http://www.force2b.net/index.php/2010/12/dreamforce-poll-1/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 13:00:25 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Poll]]></category>
		<category><![CDATA[Salesforce.com]]></category>
		<category><![CDATA[Dreamforce]]></category>

		<guid isPermaLink="false">http://www.force2b.net/?p=382</guid>
		<description><![CDATA[Dreamforce 2010 is only one week away! For the week of Dreamforce I&#8217;ll be posting a different poll everyday and then sending it via Twitter and Dreamforce with the #df10 hashtag. Stop by each day to add your votes or to see how others are voting. What do you most want to get out of DreamForce 2010?survey software]]></description>
			<content:encoded><![CDATA[<h3><strong><span style="color: #000000;">Dreamforce 2010 is only one week away!</span></strong></h3>
<p>For the week of Dreamforce I&#8217;ll be posting a different poll everyday and then sending it via Twitter and Dreamforce with the #df10 hashtag. Stop by each day to add your votes or to see how others are voting.</p>
<p><script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/4095361.js"></script><br />
<noscript><br />
	<a href="http://polldaddy.com/poll/4095361/">What do you most want to get out of DreamForce 2010?</a><span style="font-size:9px;"><a href="http://polldaddy.com/features-surveys/">survey software</a></span><br />
</noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2010/12/dreamforce-poll-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Best place for a beer during Dreamforce 2010</title>
		<link>http://www.force2b.net/index.php/2010/11/dreamforce-beers/</link>
		<comments>http://www.force2b.net/index.php/2010/11/dreamforce-beers/#comments</comments>
		<pubDate>Mon, 22 Nov 2010 13:00:25 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Poll]]></category>
		<category><![CDATA[Salesforce.com]]></category>
		<category><![CDATA[Dreamforce]]></category>

		<guid isPermaLink="false">http://www.force2b.net/?p=392</guid>
		<description><![CDATA[After a long day at Dreamforce, where do you go for a good beer? Good Beer Chatter Group: https://dreamevent.my.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F930000000CcXr Best place for a beer after a long day at DreamforceMarket Research]]></description>
			<content:encoded><![CDATA[<h3><span style="color: #000000;">After a long day at Dreamforce, where do you go for a good beer?</span></h3>
<p>Good Beer Chatter Group: <a href="https://dreamevent.my.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F930000000CcXr">https://dreamevent.my.salesforce.com/_ui/core/chatter/groups/GroupProfilePage?g=0F930000000CcXr</a></p>
<p><script src="http://static.polldaddy.com/p/4095530.js" type="text/javascript"></script><br />
<noscript><br />
<a href="http://polldaddy.com/poll/4095530/">Best place for a beer after a long day at Dreamforce</a><span style="font-size:9px;"><a href="http://polldaddy.com/features-surveys/">Market Research</a></span><br />
</noscript></p>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2010/11/dreamforce-beers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Icons available Salesforce.com</title>
		<link>http://www.force2b.net/index.php/2010/08/salesforce-icons/</link>
		<comments>http://www.force2b.net/index.php/2010/08/salesforce-icons/#comments</comments>
		<pubDate>Mon, 16 Aug 2010 14:20:22 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Salesforce.com]]></category>
		<category><![CDATA[VisualForce]]></category>

		<guid isPermaLink="false">http://www.force2b.net/?p=364</guid>
		<description><![CDATA[SalesForce.com Icons Available for VisualForce Pages and Formulas]]></description>
			<content:encoded><![CDATA[<p><a href="http://free-121d5f44d20-121d603d1c5-121ee2b8103.force.com/force2b/salesforceicons"><img class="alignright size-medium wp-image-366" title="SalesForceIcons" src="http://www.force2b.net/wp-content/uploads/2010/08/SalesForceIcons-300x201.png" alt="" width="300" height="201" /></a>Like many of you, when building a VisualForce page, or sometimes an Image Formula, I find myself looking for icons to use on the page. Of course, whenever possible I want like the icons to look like they belong in  Salesforce.com.</p>
<p>As you might expect, Salesforce.com has a series of icons available for public use, though with the exception of the &#8220;Samples&#8221; icons at the bottom of the page linked below, none of these icons are &#8220;official&#8221; and so there is always that possibility that they may disappear or change without notice.</p>
<p>The link below is to a Sites page that displays the icons I found by reviewing the CSS and browsing through the Discussion boards. Technically, there are many other images you can find by examining the CSS or Salesforce source, however many of these were Sprites or background images that we&#8217;re necessarily re-usable &#8220;icons&#8221;.</p>
<p>To get the URL for a given icon, right-click on it and select &#8220;View Image&#8221; or &#8220;Copy Image Location&#8221;. When copying the URL for the image, do <strong>not</strong> link to these specifc images using my free Sites URL. Instead, your VisualForce page should reference the relative path to the image as it&#8217;s stored on Salesforce.com&#8217;s site:</p>
<p style="padding-left: 30px;">Example: &lt;img src=&#8221;/img/arrow_dwn.gif&#8221; /&gt; OR &lt;apex:image value=&#8221;/img/arrow_dwn.gif&#8221; /&gt; to render as  <img src="http://free-121d5f44d20-121d603d1c5-121ee2b8103.force.com/img/arrow_dwn.gif" alt="" /></p>
<p><a href="http://free-121d5f44d20-121d603d1c5-121ee2b8103.force.com/force2b/salesforceicons" target="_blank">http://free-121d5f44d20-121d603d1c5-121ee2b8103.force.com/force2b/salesforceicons</a></p>
<p><strong><strong><strong>Note:  Please add a comment to this post if you have found other icons that should be included in this list. </strong></strong></strong></p>
<p><strong><strong> </strong></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2010/08/salesforce-icons/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Date Time and Timezone Handling in Apex</title>
		<link>http://www.force2b.net/index.php/2010/08/date-time-and-timezone-handling-in-apex/</link>
		<comments>http://www.force2b.net/index.php/2010/08/date-time-and-timezone-handling-in-apex/#comments</comments>
		<pubDate>Tue, 10 Aug 2010 16:50:56 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Salesforce.com]]></category>
		<category><![CDATA[Apex Code]]></category>

		<guid isPermaLink="false">http://www.force2b.net/?p=356</guid>
		<description><![CDATA[Date Time and Time zone Conversions for Apex code]]></description>
			<content:encoded><![CDATA[<p>I recently had to do some work converting timezones in Apex. Unfortunately, Apex is missing some key conversion functionality when it comes to handling times. I created this class to handle figuring out the time-offset of the current user (hardcoded to Eastern Time) and then use that to convert a time in another timezone. It also has a couple of handy methods for retrieving DST start/end dates and getting a list of US timezones with GMT offset.</p>
<p>Hopefully someone else out there will find this useful if they need to handle datetime conversions in their Apex code.</p>
<pre>
/* **********************************************************************************************
* TimeConversions Class
* Created by: Michael Smith/Force2b, 04/06/2010
*
************************************************************************************************ */
global class TimeConversions {
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;/* -------------------------------------------------------------------------------------
&nbsp;&nbsp;&nbsp;* Returns an Integer  of the Timezone Offset from Eastern Time for the
&nbsp;&nbsp;&nbsp;* currently logged in user
&nbsp;&nbsp;&nbsp;*
&nbsp;&nbsp;&nbsp;* This is used to convert the String DateTime (that is in Eastern Time) into a
&nbsp;&nbsp;&nbsp;* DateTime value in SalesForce. The default behavior of SFC converts the string into
&nbsp;&nbsp;&nbsp;* a local datetime value, but we need to get into Eastern Time.
&nbsp;&nbsp;&nbsp;* ------------------------------------------------------------------------------------- */
&nbsp;&nbsp;&nbsp;public Integer getCurrentUserTZOffsetFromEastern() {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map&lt;String, Integer[]&gt; tzSIDKeys = getTZSidKeys();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;User user = [SELECT ID, TimeZoneSidKey FROM User WHERE ID = :UserInfo.getUserId() LIMIT 1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date[] dstDatesNow = getDSTDates(System.Today().year());
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Integer UsersTZOffset = 0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (tzSIDKeys.get(user.TimeZoneSidKey) != null) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Get the base timezone offset from GMT for the user
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (System.Today() &gt;= dstDatesNow[0] &#038;&#038; System.Today() &lt;= dstDatesNow[1]) UsersTZOffset = tzSIDKeys.get(user.TimeZoneSidKey)[1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else UsersTZOffset = tzSIDKeys.get(user.TimeZoneSidKey)[0];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;system.debug(LoggingLevel.Error, 'Base TimeZone for Current User=' + user.TimeZoneSidKey + '/' + UsersTZOffset );
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Now make it a timezone offset from EASTERN time
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Integer EasternTZOffset = 0;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (System.Today() &gt;= dstDatesNow[0] &#038;&#038; System.Today() &lt;= dstDatesNow[1]) EasternTZOffset = tzSIDKeys.get('America/New_York')[1];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else EasternTZOffset = tzSIDKeys.get('America/New_York')[0];
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;UsersTZOffset = Math.abs(EasternTZOffset) - Math.abs(UsersTZOffset);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;system.debug(LoggingLevel.Error, 'TimeZone Offset to Eastern Time=' + UsersTZOffset );
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return UsersTZOffset ;
&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;/* -------------------------------------------------------------------------------------
&nbsp;&nbsp;&nbsp;* Returns a String Collection of the Timezone Codes based on the Timezone Offset Passed
&nbsp;&nbsp;&nbsp;* for the date passed.
&nbsp;&nbsp;&nbsp;*
&nbsp;&nbsp;&nbsp;* Based on a table from: http://en.wikipedia.org/wiki/Zone.tab
&nbsp;&nbsp;&nbsp;*
&nbsp;&nbsp;&nbsp;* getTimeZoneCode[0] = Display Text (ex: EDT)
&nbsp;&nbsp;&nbsp;* getTimeZoneCode[1] = DateTime.Format() parameter (ex: America/New_York)
&nbsp;&nbsp;&nbsp;* ------------------------------------------------------------------------------------- */
&nbsp;&nbsp;&nbsp;public string[] getTimeZoneCode(Integer tzOffset, Date theDate, Boolean isDSTObserved) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date[] dstDates = getDSTDates(theDate.year()); // [0]=startDate, [1]=endDate
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;boolean isDSTOn = (theDate &gt;= dstDates[0] &#038;&#038; theDate &lt;= dstDates[1]);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (tzOffset == 0) return new String[]{' GMT', 'Europe/London' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 4) return new String[]{' AST (UTC-04)', 'America/Puerto_Rico' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 5 &#038;&#038; isDSTOn &#038;&#038; isDSTObserved) return new String[]{' EDT (UTC-04)', 'America/New_York' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 5) return new String[]{' EST (UTC-05)', 'America/New_York' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 6 &#038;&#038; isDSTOn &#038;&#038; isDSTObserved) return new String[]{' CDT (UTC-05)', 'America/Chicago' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 6) return new String[]{' CST (UTC-06)', 'America/Chicago' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 7 &#038;&#038; !isDSTObserved)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;   return new String[]{' MST (UTC-07)', 'America/Phoenix' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 7 &#038;&#038; isDSTOn &#038;&#038; isDSTObserved) return new String[]{' MDT (UTC-06)', 'America/Denver' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 7) return new String[]{' MST (UTC-07)', 'America/Denver' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 8 &#038;&#038; isDSTOn &#038;&#038; isDSTObserved) return new String[]{' PDT (UTC-07)', 'America/Los_Angeles' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 8) return new String[]{' PST (UTC-08)', 'America/Los_Angeles' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 9 &#038;&#038; isDSTOn &#038;&#038; isDSTObserved) return new String[]{' AKDT (UTC-08)', 'America/Anchorage' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 9) return new String[]{' AKST (UTC-09)', 'America/Anchorage' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 10 &#038;&#038; !isDSTObserved)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  return new String[]{' HST (UTC-10)', 'Pacific/Honolulu' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 10 &#038;&#038; isDSTOn &#038;&#038; isDSTObserved) return new String[]{' HDT (UTC-09)', 'America/Adak' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 10) return new String[]{' HST (UTC-10)', 'America/Adak' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else if (tzOffset == 11) return new String[]{' HST (UTC-10)', 'Pacific/Pago_Pago' };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else return new String[]{' UTC-' + tzOffset, 'GMT' };
&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;/* -------------------------------------------------------------------------------------
&nbsp;&nbsp;&nbsp;* Returns a date Collection of Start/End dates for US Daylight Saving Time
&nbsp;&nbsp;&nbsp;* for the specified year.
&nbsp;&nbsp;&nbsp;*
&nbsp;&nbsp;&nbsp;* Based on code from: http://www.webexhibits.org/daylightsaving/b2.html
&nbsp;&nbsp;&nbsp;* ------------------------------------------------------------------------------------- */
&nbsp;&nbsp;&nbsp;public Date[] getDSTDates(Integer theYear) {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Long thisYear;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Long AprilDate;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Long OctoberDate;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Long MarchDate;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Long NovemberDate;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Long longSeven = 7;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;thisYear = Math.round(theYear);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AprilDate = Math.mod(2+6 * thisYear - Math.floor(thisYear / 4).longValue(), longSeven) + 1;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;OctoberDate=  Math.mod(31-( Math.floor(thisYear * 5 / 4).longValue() + 1), longSeven);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;MarchDate = 14 - Math.mod(Math.floor(1 + thisYear * 5 / 4).LongValue(), longSeven);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;NovemberDate = 7 - Math.mod(Math.floor (1 + thisYear * 5 / 4).LongValue(), longSeven);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string startDate = (thisYear &gt; 2006 ? ('03/'+MarchDate) : ('04/'+AprilDate)) + '/' + thisYear;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;string endDate = (thisYear &gt; 2006 ? ('11/'+NovemberDate):('10/'+OctoberDate))+ '/' + thisYear;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Date[] rtnDates = new List&lt;Date&gt;();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rtnDates.add(Date.parse(startDate));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;rtnDates.add(Date.parse(endDate));
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return rtnDates;
&nbsp;&nbsp;&nbsp;}
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;public Map&lt;String, Integer[]&gt; getTZSidKeys() {
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Map&lt;String, Integer[]&gt; tzSIDKeys = new Map&lt;String, Integer[]&gt;();
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Adak', new Integer[]{-10, -9});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Anchorage', new Integer[]{-9, -8});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Chicago', new Integer[]{-6, -5});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Denver', new Integer[]{-7, -6});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Detroit', new Integer[]{-5, -4});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Halifax', new Integer[]{-4, -3});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Indianapolis', new Integer[]{-5, -4});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Los_Angeles', new Integer[]{-8, -7});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Montreal', new Integer[]{-5, -4});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/New_York', new Integer[]{-5, -4});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Panama', new Integer[]{-5, -5});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Phoenix', new Integer[]{-7, -7});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Puerto_Rico', new Integer[]{-4, -4});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Toronto', new Integer[]{-5, -4});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('America/Vancouver', new Integer[]{-8, -7});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('Europe/London', new Integer[]{0, 1});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('Pacific/Honolulu', new Integer[]{-10, -10});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;tzSIDKeys.put('Pacific/Pago_Pago', new Integer[]{-11, -11});
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return tzSIDKeys;
&nbsp;&nbsp;&nbsp;}
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2010/08/date-time-and-timezone-handling-in-apex/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Getting ActionSupport to Rerender Elements on a Page</title>
		<link>http://www.force2b.net/index.php/2010/06/getting-actionsupport-to-rerender-elements-on-a-page/</link>
		<comments>http://www.force2b.net/index.php/2010/06/getting-actionsupport-to-rerender-elements-on-a-page/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 10:57:40 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Salesforce.com]]></category>
		<category><![CDATA[VisualForce]]></category>

		<guid isPermaLink="false">http://www.sfcnmore.com/?p=305</guid>
		<description><![CDATA[How to get the VisualForce apex:ActionSupport tag to rerender elements based on field value changes]]></description>
			<content:encoded><![CDATA[<p>Up until today I have been struggling with getting the <a href="http://www.salesforce.com/us/developer/docs/pages/Content/pages_compref_actionSupport.htm" target="_blank">apex:actionSupport</a> tag to work as documented. Apparently, it looks like VisualForce is extremely picky about what it will  rerender. I found this great post on the developer boards that resolved my  issue.</p>
<p><a href="http://community.salesforce.com/t5/Visualforce-Development/actionSupport-rerender-problem/m-p/150628/highlight/true#M17485">http://community.salesforce.com/t5/Visualforce-Development/actionSupport-rerender-problem/m-p/150628/highlight/true#M17485</a></p>
<p>What it came down to was making sure that the elements being  rerendered did not have a rendered=&#8221;" attribute in the  tag. For example,  in the code below I wanted to hide the second picklist if the value of the first  picklist was &#8216;Standard&#8217;. I kept trying to rerender the pageBlockSectionItem area  and it wouldn&#8217;t work. By wrapping the pageBlockSectionItem block inside of  another tag (pageBlockSection in this case) and then rerendering <em>that</em> ID in the actionSupport tag. I tried wrapping it in an outputPanel tag, but that  screws up the formatting of the labels and fields. The same was true for  the <em><span style="color: #800000;">customConfigurationPanel</span></em> area. I wrapped  that pageBlock in an outputPanel tag and made sure the rendered attribute was on  the pageBlock not the outputPanel tag. Works great.</p>
<pre>
&lt;apex:pageBlock id="MainConfigurationBlock" title="Standard Integration Options"
&lt;apex:pageBlockSection id="configTypeSection" columns="1"&gt;
   &lt;apex:pageBlockSectionItem &gt;
      &lt;apex:outputLabel&gt;Integration Type&lt;/apex:outputLabel&gt;
      &lt;apex:selectList value="{!config.IntegrationType__c}" size="1"&gt;
         &lt;apex:selectOption itemValue="Standard" itemLabel="Standard"/&gt;
         &lt;apex:selectOption itemValue="Custom" itemLabel="Custom"/&gt;
         &lt;apex:actionSupport event="onchange" status="StatusChange"
          rerender="activityObjectSection,customConfigurationPanel" /&gt;
      &lt;/apex:selectList&gt;
   &lt;/apex:pageBlockSectionItem&gt;
&lt;/apex:pageBlockSection&gt;

&lt;apex:pageBlockSection id="activityObjectSection" columns="1"&gt;
   &lt;apex:pageBlockSectionItem rendered="{!config.IntegrationType__c = 'Custom'}"&gt;
      &lt;apex:outputLabel id="activityObjectLabel"&gt;Activity Object&lt;/apex:outputLabel&gt;
      &lt;apex:selectList id="activityObjectField" value="{!config.ActivityObject__c}" size="1"
      rendered="{!config.IntegrationType__c = 'Custom'}" &gt;
         &lt;apex:selectOptions value="{!objects}"/&gt;
      &lt;/apex:selectList&gt;
   &lt;/apex:pageBlockSectionItem&gt;
&lt;/apex:pageBlockSection&gt;
&lt;/apex:pageBlock&gt;

&lt;apex:actionStatus startText="Updating page ..." id="StatusChange"/&gt;

&lt;apex:outputPanel id="customConfigurationPanel"&gt;
   &lt;apex:pageBlock id="customConfigurationBlock" title="Custom Integration Options"
   rendered="{!config.IntegrationType__c='Custom' &#038;&#038; config.ActivityObject__c != null}"&gt;

    ..... other fields that I don't want displayed  ....
    ..... if the IntegrationType is "Standard"      ....

   &lt;/apex:pageBlock&gt;
&lt;/apex:outputPanel id="customConfigurationPanel"&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2010/06/getting-actionsupport-to-rerender-elements-on-a-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hiding Edit Links for Related Lists/Views on a VisualForce Page</title>
		<link>http://www.force2b.net/index.php/2010/06/hiding-edit-links-for-related-listsviews-on-a-visualforce-page/</link>
		<comments>http://www.force2b.net/index.php/2010/06/hiding-edit-links-for-related-listsviews-on-a-visualforce-page/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 14:58:02 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Salesforce.com]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[VisualForce]]></category>

		<guid isPermaLink="false">http://www.sfcnmore.com/?p=299</guid>
		<description><![CDATA[I had a situation the other day where I needed to hide the Edit &#38; Del links that appear on both the ListView and Related Lists. Luckily in both cases the pages were VisualForce pages, but I did not want to manually recreate the ListViews or Related Lists by hand. My solution was to use jQuery to quickly select and]]></description>
			<content:encoded><![CDATA[<p>I had a situation the other day where I needed to hide the Edit &amp; Del links that appear on both the ListView and Related Lists. Luckily in both cases the pages were VisualForce pages, but I did not want to manually recreate the ListViews or Related Lists by hand.</p>
<p>My solution was to use jQuery to quickly select and hide all elements that had a class of &#8220;actionLink&#8221;:</p>
<pre>&lt;apex:page tabStyle="Workshops__tab"&gt;

&lt;apex:includeScript value="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"/&gt;

&lt;apex:sectionHeader title="Data Entry Portal" subTitle="Workshops" /&gt;
&lt;apex:pageMessages /&gt;

	&lt;apex:ListViews type="Workshop__c" /&gt;

&lt;script&gt;
    // Using jQuery, hide all of the actionLinks (edit link specifically) on the Workshops
    // This forces the user to click the Workshop name and then click the [Edit] button
    $(".actionLink").css("display","none");
&lt;/script&gt;

&lt;/apex:page&gt;</pre>
<p>I also posted an Idea to the Idea Exchange to allow easy selection of which links should appear on the standard List Views and Related Lists: <a href="https://sites.secure.force.com/ideaexchange/ideaView?c=09a30000000D9xt&amp;id=08730000000I3uN" target="_blank">https://sites.secure.force.com/ideaexchange/ideaView?c=09a30000000D9xt&amp;id=08730000000I3uN</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2010/06/hiding-edit-links-for-related-listsviews-on-a-visualforce-page/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Aggregate SOQL Functions</title>
		<link>http://www.force2b.net/index.php/2010/02/aggregate-soql-functions/</link>
		<comments>http://www.force2b.net/index.php/2010/02/aggregate-soql-functions/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 17:54:07 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Salesforce.com]]></category>
		<category><![CDATA[Apex Code]]></category>
		<category><![CDATA[Apex Trigger]]></category>

		<guid isPermaLink="false">http://www.sfcnmore.com/?p=294</guid>
		<description><![CDATA[Aggregate functions in SalesForce.com SOQL]]></description>
			<content:encoded><![CDATA[<p>I couldn’t be happier that the new 18.0 (Spring ’10) API Release from Salesforce.com now supports aggregate functions in SOQL.</p>
<p>Links to resources:</p>
<ul>
<li><a href="http://developer.force.com/releases/release/Spring10/Aggregate+Functions">http://developer.force.com/releases/release/Spring10/Aggregate+Functions</a></li>
<li><a href="http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select.htm">http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_soql_select.htm</a></li>
</ul>
<p>The new SUM() and GROUP BY features can really simplify writing custom Roll-up Triggers.</p>
<p>Below is a relatively simple Trigger that rolls up Budget numbers by the Previous, Current and Next year to the parent Program__c object. By using the Calendar_Year() function, you can see how easy it is to create a single SOQL statement that does the summing in a single statement.</p>
<pre>trigger Program_Budget_Rollup on Program_Budget__c (after delete, after insert, after update) {

    Set&lt;String&gt; programIDs = new Set&lt;String&gt;();

    //************************************************
    // Build a LIST of Program ID's that will
    // need recalculating
    //************************************************
    if(Trigger.isInsert || Trigger.isUpdate){
        for(Program_Budget__c te : trigger.new){
            if(te.Program__c != null){
                if(!programIDs.contains(te.Program__c)) programIDs.add(te.Program__c);
            }
        }
    }  // INSERT/UPDATE Trigger

    if(Trigger.isDelete || Trigger.isUpdate){
        for(Program_Budget__c te : trigger.old){
            if(te.Program__c != null){
                if(!programIDs.contains(te.Program__c)) programIDs.add(te.Program__c);
            }
        }
    }  // DELETE/UPDATE Trigger

    if(programIDs .size() &gt; 0) {

        Map&lt;ID, Program__c&gt; programs = new Map&lt;ID, Program__c&gt;();
        Program__c d = null;

        for (AggregateResult dr : [SELECT Program__c, CALENDAR_YEAR(Date_c) Year, SUM(Amount__c) Amount
        FROM Program_Budget__c GROUP BY Program__c, CALENDAR_YEAR(Date__c)]) {

            String dID = (string)dr.Get('Program__c');
            // get the record or create a new one
            if (programs.get(dID) == null)
                d = new Program__c(ID = dID,
                Previous_Year_Budget__c = 0,
                Current_Year_Budget__c = 0,
                Next_Year_Budget__c = 0,
                Total_Budget__c = 0);
            else
               d = programs.get(dID);

            // update the donation total fields
            Decimal amt = (Decimal)dr.Get('Amount');
            String fyr = (String)dr.GetDate('Year');
            Integer yr = Integer.valueOf(fyr);
            if (yr == Date.today().year()) d.Current_Year_Budget__c = amt;
            if (yr == (Date.today().year() - 1)) d.Previous_Year_Budget__c = amt;
            if (yr == (Date.today().year() + 1)) d.Next_Year_Budget__c = amt;
            d.Total_Budget__c = d.Total_Budget__c + amt;

            // push the record back into the Map
            programs.put(dID, d);
        }

        //commit the changes to Salesforce
        update programs.values();

    }

}</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2010/02/aggregate-soql-functions/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Hiding Custom Buttons on a VisualForce Page</title>
		<link>http://www.force2b.net/index.php/2009/10/hiding-custom-buttons-on-a-visualforce-page/</link>
		<comments>http://www.force2b.net/index.php/2009/10/hiding-custom-buttons-on-a-visualforce-page/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 23:33:15 +0000</pubDate>
		<dc:creator>mgsmith</dc:creator>
				<category><![CDATA[Salesforce.com]]></category>
		<category><![CDATA[VisualForce]]></category>

		<guid isPermaLink="false">http://www.sfcnmore.com/?p=261</guid>
		<description><![CDATA[Note: Jason (aka @tehnrd) posted a very creative solution to hide custom buttons recently. Absolutely worth checking out: http://www.tehnrd.com/show-and-hide-buttons-on-page-layouts/ Sorry it’s been so long time since my last blog post. Life and work just seem to get in the way. I recently wanted to setup some custom buttons that could be dynamically hidden or renamed on the page. As you]]></description>
			<content:encoded><![CDATA[<p><strong>Note: Jason (aka @tehnrd) posted a very creative solution to hide custom buttons recently. Absolutely worth checking out: <a href="http://www.tehnrd.com/show-and-hide-buttons-on-page-layouts/" target="_blank">http://www.tehnrd.com/show-and-hide-buttons-on-page-layouts/</a></strong></p>
<hr />Sorry it’s been so long time since my last blog post. Life and  work just seem to get in the way.</p>
<p>I recently wanted to setup some custom buttons that could be dynamically hidden or renamed on the page. As you probably know, Salesforce.com does not currently have the ability to hide buttons on a page layout. However, it can be done through a combination of VisualForce and JavaScript.</p>
<p>Idea to vote on: <a title="http://ideas.salesforce.com/article/show/101209/Limit_the_Visibility_of_a_Custom_Button" href="http://ideas.salesforce.com/article/show/101209/Limit_the_Visibility_of_a_Custom_Button" target="_blank">http://ideas.salesforce.com/article/show/101209/Limit_the_Visibility_of_a_Custom_Button</a></p>
<p>The most important thing to note here is that this can only be done on a VisualForce page. It’s not possible to hide or take any actions on custom buttons that are on a standard page. This is due to cross-site scripting limitations of all browsers that prevent JavaScript from modifying the DOM of a window at another domain. You’ll see why as we get into the coding.</p>
<p>To start, I’ve taken a simple custom object and created an even simpler VisualForce page  to use for the VIEW. Once created, just override the VIEW option with this page.</p>
<pre>&lt;apex:page standardController="Application__c" title="Application For {!Application__c.Contact_Name__c}" &gt;
    &lt;apex:Detail subject="{!Application__c.ID}" relatedList="true" /&gt;
&lt;/apex:page&gt;</pre>
<p>At first, the result is visually the same. Now let’s add a custom button to the page.</p>
<p><img class="aligncenter size-full wp-image-262" title="Screenshot_NewButton" src="http://www.sfcnmore.com/wp-content/uploads/2009/10/Screenshot_NewButton.jpg" alt="Screenshot_NewButton" width="535" height="380" /></p>
<p>In this case, I named the button &#8220;Update_Status&#8221;. The &#8216;Name&#8217; is critical to modifying the button in the VisualForce. Though, the name must always be lowercase in your VisualForce page. For example, even though I have &#8220;Update_Status&#8221; as the Name here, my VisualForce code will reference &#8220;update_status&#8221;.</p>
<p>Now comes the fun. By adding some JavaScript to the VisualForce page you can manipulate the button – hide it, disable it, or even change the button label.</p>
<pre>&lt;script&gt;
function hideButton(btnName) {
  try{
    var buttons = parent.document.getElementsByName(btnName);
    for (var i=0; i &lt; buttons.length; i++) {
      buttons[i].className="btnDisabled ";
      buttons[i].disabled=true;
      buttons[i].type='hidden';
    }
  } catch(e) {
    // var ee = e.message || 0; alert('Error: \n\n'+e+'\n'+ee);
  }
}

function renameButton(btnName, newTitle) {
  try{
    var buttons = parent.document.getElementsByName(btnName);
    for (var i=0; i &lt; buttons.length; i++) {
      buttons[i].value=newTitle;
    }
  } catch(e) {
    // var ee = e.message || 0; alert('Error: \n\n'+e+'\n'+ee);
  }
}
&lt;/script&gt;</pre>
<p>We’ll start with the above two functions. By passing in a button name to the hideButton() function we can hide it on the page. Passing in the same button name and a new title to renameButton() will change the button label on the page. Below is my full VisualForce page code:</p>
<pre>&lt;apex:page standardController="Application__c" title="Application For {!Application__c.Contact_Name__c}" &gt;
    &lt;apex:Detail subject="{!Application__c.ID}" relatedList="true" /&gt;

&lt;script type="text/javascript"&gt;
// The code below is executed as soon as the page loads. Based on the value of the Status__c field
// it either hides or renames the update_status button
if ('{!Application__c.Status__c}' == 'Submitted') renameButton("update_status", "Mark as In-Review");
if ('{!Application__c.Status__c}' == 'In-Review') hideButton("update_status");
if ('{!Application__c.Status__c}' == 'Deposit Pending') renameButton("update_status", "Confirm Deposit Received");
if ('{!Application__c.Status__c}' == 'Deposit Received') hideButton("update_status");
if ('{!Application__c.Status__c}' == 'Approved') hideButton("update_status");
if ('{!Application__c.Status__c}' == 'Rejected') hideButton("update_status");

function hideButton(btnName) {
  try{
    var buttons = parent.document.getElementsByName(btnName);
    for (var i=0; i &lt; buttons.length; i++) {
      buttons[i].className="btnDisabled ";
      buttons[i].disabled=true;
      buttons[i].type='hidden';
    }
  } catch(e) {
    // var ee = e.message || 0; alert('Error: \n\n'+e+'\n'+ee);
  }
}

function renameButton(btnName, newTitle) {
  try{
    var buttons = parent.document.getElementsByName(btnName);
    for (var i=0; i &lt; buttons.length; i++) {
      buttons[i].value=newTitle;
    }
  } catch(e) {
    // var ee = e.message || 0; alert('Error: \n\n'+e+'\n'+ee);
  }
}
&lt;/script&gt;</pre>
<p>Screen captures of the page with button showing and hidden:</p>
<p><img class="aligncenter size-full wp-image-286" title="ScreenCapture_WithButton" src="http://www.sfcnmore.com/wp-content/uploads/2009/10/ScreenCapture_WithButton.jpg" alt="ScreenCapture_WithButton" width="523" height="103" /><img class="aligncenter size-full wp-image-287" title="ScreenCapture_WithoutButton" src="http://www.sfcnmore.com/wp-content/uploads/2009/10/ScreenCapture_WithoutButton.jpg" alt="ScreenCapture_WithoutButton" width="523" height="103" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.force2b.net/index.php/2009/10/hiding-custom-buttons-on-a-visualforce-page/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

