<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;DUYERXczfCp7ImA9WhRbEU0.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474</id><updated>2012-02-01T09:38:24.984-05:00</updated><category term="S-Controls" /><category term="Apex Code" /><category term="Components" /><category term="Google Apps" /><category term="Visualforce" /><title>Salesforce &lt;Source&gt;</title><subtitle type="html">Salesforce &amp;lt;Source&amp;gt; blog is dedicated to Salesforce.com professionals and developers who are looking for new ideas, tips and tricks and know-how in force.com platform.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://salesforcesource.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/SalesforceTips" /><feedburner:info uri="salesforcetips" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;A0cDRX0-fip7ImA9WxBUGE0.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-5176011007730196758</id><published>2010-03-05T12:06:00.001-05:00</published><updated>2010-03-05T12:11:14.356-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-05T12:11:14.356-05:00</app:edited><title>Three Reasons Why You Should Do Away From Force.com Sites!</title><content type="html">Working on several large projects in the past to address community needs in the CRM arena, force.com Sites seems to be an attractive and suitable choice which directly integrates with your CRM application. You can open up and share your CRM tabs, objects and data to your target community on the web and it's all fully secure.&lt;br /&gt;
&lt;br /&gt;
The basic customer portal theme seem to be a bit tasteless if you are to use the standard Visualforce components however utilizing them has two benefits, first and the most important is speed in delivery of the project, secondly if you are to add your ideas or solutions, as is, then all your tabs and pages would enjoy the same look and feel.&lt;br /&gt;
&lt;br /&gt;
However, there are some major issues that Salesforce.com still needs to address before this platform is fully ready for large scale projects. &lt;br /&gt;
&lt;br /&gt;
Here are some of those, I came across:&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1) Stability&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
Since the technology is fairly new and Salesforce.com is rapidly trying to introduce new ones and get ahead of the competition, it seems that they inevitably had to make some sacrifices. In many cases I encountered bugs that could have been easily caught and removed from the system.&lt;br /&gt;
One example of which is the sign up process in force.con customer portals, when a new user registers, two records will be created, a Contact record and Portal User record. The Contact record should be linked to an Account record as well. &lt;br /&gt;
The problem is that if you created an account at the sign-up time and then tried to link the new Contact to that Account, because the Guest user in Salesforce.com does not have a role and therefore can not be the owner of an account in Salesforce then the whole process would fail (so why allowing the guest user to create an Account in the security profile!). Furthermore, if the Account owner is a deactivated-user, the same error would be thrown!&lt;br /&gt;
&lt;br /&gt;
In many other cases I encountered styling issues, where, in ajax calls the portal styles would go nuts or I heard some user complains from that the pages were not behaving/rendering the same way in different browsers.&lt;br /&gt;
&lt;br /&gt;
Funny thing is that even if you turn off standard styling in your visualforce page, force.com still includes them in your pages, causeing conflicts and a lot of headache!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2) Diagnostics&lt;/b&gt;&lt;br /&gt;
There are no system diagnostics provided to you out-of-the-box. You are on your own to implement one to be able to find out what's going on with the internet users trying to sign up, login and use your customer portal!&lt;br /&gt;
&lt;br /&gt;
The thing that makes the sites de-bug and diagnostic process very hard is that it runs your visualforce pages on a different security model (two different profiles compare to standard profiles in Salesforce) which you can not mimic in your own salesforce.com environment.So you are forced to create sample portal users and browse it like any other user and see/test it for yourself. The downside to this is that the errors are not really shown to you properly when you are logged in as a Guest user or Customer portal User.&lt;br /&gt;
&lt;br /&gt;
In many cases, I saw as a result of an Apex exception the user sees the "under construction" page!!&lt;br /&gt;
Even though you have specifically configured your site to show your own custom error page! Also if the user browses a page URL that does not exists.... they do not necessarily always see your 404 error page but rather the one and only "under construction" page again!!&lt;br /&gt;
&lt;br /&gt;
All for you to rely on is the famous Apex error notification email which potentially can indicate something went wrong for a user. The other problem is that only the last person who has deployed the code receives these emails. In larger projects were a group of developers are working on the tasks, this does not seem to be a practical solution to provide diagnostics.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3) Profile Limitations&lt;/b&gt;&lt;br /&gt;
Salesforce is imposing several security limitations on sites and customer portals that do not exist with API integrations. So folks who are using an external application as their community portal and integrate with Salesforce enjoy more freedom than others who want to utilize force.com sites!&lt;br /&gt;
&lt;br /&gt;
One example of which is that the customer portal profile can not update Contact records. This is all nice if you want to protect your business data and separate them from user's profile data. However, in many business cases your requirement may be to add a few custom fields on the contact record and make them available to the portal (as a self-service data management type of business operations, where possible you'd rather have the customer manage their own data).&lt;br /&gt;
&lt;br /&gt;
I have seen people adding that to the ideas site, but this is a practical need which is not available at the moment in force.com sites.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-5176011007730196758?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8RPSV2qXBr2f_EBW-_BC6KoCDtc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8RPSV2qXBr2f_EBW-_BC6KoCDtc/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8RPSV2qXBr2f_EBW-_BC6KoCDtc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8RPSV2qXBr2f_EBW-_BC6KoCDtc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/PW38RUxBT3I" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/5176011007730196758/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2010/03/three-reasons-why-you-should-stay-away.html#comment-form" title="6 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/5176011007730196758?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/5176011007730196758?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/PW38RUxBT3I/three-reasons-why-you-should-stay-away.html" title="Three Reasons Why You Should Do Away From Force.com Sites!" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>6</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2010/03/three-reasons-why-you-should-stay-away.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEQFQng5cCp7ImA9WxBWEEg.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-3126924980097877442</id><published>2010-02-01T13:39:00.002-05:00</published><updated>2010-02-01T15:31:53.628-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-01T15:31:53.628-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Apex Code" /><title>Utilizing the Power of Batch Apex and Async Operations</title><content type="html">If you have tried before to remove custom object records in bulk from your org, you know the hassle you need to go through to export the records into an excel file and then have the DataLoader delete those records.&lt;br /&gt;&lt;br /&gt;Not only that, what if you need to perform further data integrity tasks before removing the records?&lt;br /&gt;&lt;br /&gt;Mass updating, inserting and other similar scenarios like this can be more conveniently handled with force.com's Batch Apex. With Batch Apex you can now build complex, long-running processes on the platform. This feature is very useful for time to time data cleansing, archiving or data quality improvement operations.&lt;br /&gt;&lt;br /&gt;One thing that you need to consider is that you should trigger the batch job using Apex code only and force.com by default does not provide scheduling feature your batchable Apex classes. In order to do that you need to write Apex class that implements a "Schedulable"  interface.&lt;br /&gt;&lt;br /&gt;The following example shows how you can utilize the model to mass delete records of any object in force.com platform.&lt;br /&gt;&lt;br /&gt;In order to develop your Batch Apex, you need to create a new Apex class which extends "Database.Batchable" interface.&lt;br /&gt;&lt;br /&gt;This interface demands for three methods to be implemented:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;start&lt;/li&gt;&lt;li&gt;execute&lt;/li&gt;&lt;li&gt;finish&lt;/li&gt;&lt;/ul&gt;"start" method is called at the beginning of a batch Apex job. Use this method to collect the records (of objects) to be passed to the "execute" method for processing. The Apex engine, automatically breaks the massive numbers of records you selected into smaller batches and repeatedly calls the "execute" method until all records are processed.&lt;br /&gt;&lt;br /&gt;The "finish" method is called once all the batches are processed. You can use this method to carry out any post-processing operation such as sending out an email confirmation on the status of the batch operation.&lt;br /&gt;&lt;br /&gt;Let's take a closer look at each of these methods:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 100px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;global Database.QueryLocator start(Database.BatchableContext BC) {&lt;br /&gt;&lt;span class="rem"&gt;//passing the query string to the Database object.      &lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;return&lt;/span&gt; Database.getQueryLocator(query);&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;Use the Database.getQueryLocator in the "start" method to dynamically load data into the Batch Apex class. Using a Querylocator object, the governor limit for the total number of records retrieved from the database is bypassed.&lt;br /&gt;&lt;br /&gt;Alternatively you can use the iterable when you need to create a complex scope for your batch job.&lt;br /&gt;&lt;br /&gt;Execute method:&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 100px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;global &lt;span class="kwrd"&gt;void&lt;/span&gt; execute(Database.BatchableContext BC, List&amp;lt;sObject&amp;gt; scope) {&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;// in this sample, we simply delete all the records in scope    &lt;/span&gt;&lt;br /&gt;delete scope;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;This method provides two parameters Database.BatchableContext and a list of records (referred to as "scope").  BatchableContext is generally used for tracking the progress of the batch job by all Batchable interface methods. We will use this class more in our "finish" method.&lt;br /&gt;&lt;br /&gt;Finish method:&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 250px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;global &lt;span class="kwrd"&gt;void&lt;/span&gt; finish(Database.BatchableContext BC){&lt;br /&gt;&lt;span class="rem"&gt;// Get the ID of the AsyncApexJob representing this batch job  &lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;// from Database.BatchableContext.  &lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;// Query the AsyncApexJob object to retrieve the current job's information.  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;AsyncApexJob a = [Select Id, Status, NumberOfErrors, JobItemsProcessed,&lt;br /&gt;  TotalJobItems, CreatedBy.Email&lt;br /&gt;  from AsyncApexJob &lt;span class="kwrd"&gt;where&lt;/span&gt; Id =:BC.getJobId()];&lt;br /&gt;&lt;span class="rem"&gt;// Send an email to the Apex job's submitter notifying of job completion.  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Messaging.SingleEmailMessage mail = &lt;span class="kwrd"&gt;new&lt;/span&gt; Messaging.SingleEmailMessage();&lt;br /&gt;String[] toAddresses = &lt;span class="kwrd"&gt;new&lt;/span&gt; String[] {a.CreatedBy.Email};&lt;br /&gt;mail.setToAddresses(toAddresses);&lt;br /&gt;mail.setSubject(&lt;span class="str"&gt;'Apex Sharing Recalculation '&lt;/span&gt; + a.Status);&lt;br /&gt;mail.setPlainTextBody&lt;br /&gt;(&lt;span class="str"&gt;'The batch Apex job processed '&lt;/span&gt; + a.TotalJobItems +&lt;br /&gt;&lt;span class="str"&gt;' batches with '&lt;/span&gt;+ a.NumberOfErrors + &lt;span class="str"&gt;' failures.'&lt;/span&gt;);&lt;br /&gt;Messaging.sendEmail(&lt;span class="kwrd"&gt;new&lt;/span&gt; Messaging.SingleEmailMessage[] { mail });&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;By using the BatchableContext we are able to retrieve the jobId of our batch job. AsyncApexJob object in force.com allows you to gain access to the status of the async jobs as shown in the above example.&lt;br /&gt;&lt;br /&gt;In this method I have utilized the Apex email library to send a notification to the owner of the batch job (whoever triggered the job in the first place).&lt;br /&gt;&lt;br /&gt;Now, let's put it all together:&lt;br /&gt;&lt;b:includable id="allcode"&gt;&lt;br /&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;global &lt;span class="kwrd"&gt;class&lt;/span&gt; MassDeleteRecords implements  Database.Batchable&amp;lt;sObject&amp;gt; {&lt;br /&gt;&lt;br /&gt;global final &lt;span class="kwrd"&gt;string&lt;/span&gt; query;&lt;br /&gt;&lt;br /&gt;global MassDeleteRecords (String q)&lt;br /&gt;{&lt;br /&gt;   query = q;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;global Database.QueryLocator start(Database.BatchableContext BC){&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;return&lt;/span&gt; Database.getQueryLocator(query);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;global &lt;span class="kwrd"&gt;void&lt;/span&gt; execute(Database.BatchableContext BC, List&amp;lt;sObject&amp;gt; scope){&lt;br /&gt;&lt;br /&gt;  delete scope;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;global &lt;span class="kwrd"&gt;void&lt;/span&gt; finish(Database.BatchableContext BC){&lt;br /&gt;  &lt;span class="rem"&gt;// Get the ID of the AsyncApexJob representing this batch job  &lt;/span&gt;&lt;br /&gt;  &lt;span class="rem"&gt;// from Database.BatchableContext.    &lt;/span&gt;&lt;br /&gt;  &lt;span class="rem"&gt;// Query the AsyncApexJob object to retrieve the current job's information.  &lt;/span&gt;&lt;br /&gt;&lt;br /&gt; AsyncApexJob a = [Select Id, Status, NumberOfErrors, JobItemsProcessed,&lt;br /&gt;   TotalJobItems, CreatedBy.Email&lt;br /&gt;   from AsyncApexJob &lt;span class="kwrd"&gt;where&lt;/span&gt; Id =:BC.getJobId()];&lt;br /&gt;&lt;br /&gt;  &lt;span class="rem"&gt;// Send an email to the Apex job's submitter notifying of job completion.  &lt;/span&gt;&lt;br /&gt;  Messaging.SingleEmailMessage mail = &lt;span class="kwrd"&gt;new&lt;/span&gt; Messaging.SingleEmailMessage();&lt;br /&gt;  String[] toAddresses = &lt;span class="kwrd"&gt;new&lt;/span&gt; String[] {a.CreatedBy.Email};&lt;br /&gt;  mail.setToAddresses(toAddresses);&lt;br /&gt;  mail.setSubject(&lt;span class="str"&gt;'Apex Sharing Recalculation '&lt;/span&gt; + a.Status);&lt;br /&gt;  mail.setPlainTextBody(&lt;span class="str"&gt;'The batch Apex job processed '&lt;/span&gt; + a.TotalJobItems +&lt;br /&gt;    &lt;span class="str"&gt;' batches with '&lt;/span&gt;+ a.NumberOfErrors + &lt;span class="str"&gt;' failures.'&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;  Messaging.sendEmail(&lt;span class="kwrd"&gt;new&lt;/span&gt; Messaging.SingleEmailMessage[] { mail });&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt; Ok, that's as far as we go for the Batchable Apex class in this article.&lt;br /&gt;&lt;br /&gt;Now let's write the code in Apex to run the class and test it:&lt;br /&gt;&lt;b:includable id="runit"&gt;&lt;br /&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 100px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;String query = &lt;span class="str"&gt;'SELECT id, name FROM Account WHERE OwnerId = \'00520000000h57J\''&lt;/span&gt;;&lt;br /&gt;MassDeleteRecords batchApex = &lt;span class="kwrd"&gt;new&lt;/span&gt; MassDeleteRecords(query );&lt;br /&gt;ID batchprocessid = Database.executeBatch(batchApex);&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;The above code removes all accounts that the user id= 00520000000h57J owns them.&lt;br /&gt;&lt;br /&gt;As it is apparent, now you can run the batch job from within your Visualforce pages, triggers (with caution), etc.&lt;br /&gt;&lt;br /&gt;For governing limit and best practices documentation you can refer to the Apex Developer Guide.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-3126924980097877442?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7xgezDZIupr8up9XevYffmY_rpg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7xgezDZIupr8up9XevYffmY_rpg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7xgezDZIupr8up9XevYffmY_rpg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7xgezDZIupr8up9XevYffmY_rpg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/w6SXzHZeoRs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/3126924980097877442/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2010/02/utilizing-power-of-batch-apex-and-async.html#comment-form" title="13 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/3126924980097877442?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/3126924980097877442?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/w6SXzHZeoRs/utilizing-power-of-batch-apex-and-async.html" title="Utilizing the Power of Batch Apex and Async Operations" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>13</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2010/02/utilizing-power-of-batch-apex-and-async.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUICSXk5cCp7ImA9WxBQFU0.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-5452143958417863160</id><published>2010-01-14T11:26:00.007-05:00</published><updated>2010-01-14T16:12:48.728-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-14T16:12:48.728-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Apex Code" /><title>Utilizing Apex Pattern and Matcher Classes</title><content type="html">In many projects I am involved with I need to validate a string of data or transform the string into a new one with a specific format. Processing the text by the means of String primitive type methods or your custom handling could a big undertaking and time consuming task.&lt;br /&gt;&lt;br /&gt;Sometimes, one needs to write hundreds of lines of code, to process a string and make sure it’s valid (formatted as expected) or transform it into proper format. Some examples of this are validating a string to see if it’s a correct email address, postal code, phone number or URL. Some other examples are grabbing html tags or striping down the XML or HTML tag to get a clear text, trimming the whitespaces, removing duplicate lines or items and many more.&lt;br /&gt;&lt;br /&gt;Apex in Force.com platform has just the right set of classes to help you carry out such operations pretty much the same way Java does it.&lt;br /&gt;&lt;br /&gt;“A regular expression is a string that is used to match another string, using a specific syntax. Apex supports the use of the regular expression through its Pattern and Matcher classes.” Quoted right from the holly guide. Any regular expression that is written for Java can be used with Apex as well.&lt;br /&gt;&lt;br /&gt;In order to utilize these classes we first need to know what each of them does.&lt;br /&gt;&lt;br /&gt;Pattern class is designed to contain the regular expression string and you compile the expression into an object of this class. You only need to use this class once. Using this class you will be able to create a Matcher object by passing your string (on which you want to carry out surgery or validation).&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="pattern"&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 100px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;pattern myPattern = pattern.compile(&lt;span class="str"&gt;'(a(b)?)+'&lt;/span&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;Matcher in turn allows you to do further actions such as checking to see if the string matched the pattern or allows you to manipulate the original string in various ways and produce a new desired one.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 100px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;matcher myMatcher = myPattern.matcher(&lt;span class="str"&gt;'aba'&lt;/span&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;Let’s explore some samples of using regular expressions in Apex and see how we can benefit from them:&lt;br /&gt;&lt;br /&gt;My first example will be how to validate an email address. I personally had some struggles with this since the email addresses can get pretty ugly at times. Imagine this email address:&lt;br /&gt;&lt;br /&gt;name.lastname_23@ca.gov.on.com&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 250px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;String InputString = &lt;span class="str"&gt;'email@email.com'&lt;/span&gt;;&lt;br /&gt;String emailRegex = &lt;span class="str"&gt;'([a-zA-Z0-9_\\-\\.]+)@((\\[a-z]{1,3}\\.[a-z]{1,3}\\.[a-z]{1,3}\\.)|(([a-zA-Z0-9\\-]+\\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})'&lt;/span&gt;;&lt;br /&gt;Pattern MyPattern = Pattern.compile(emailRegex);&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;// Then instantiate a new Matcher object "MyMatcher"&lt;/span&gt;&lt;br /&gt;Matcher MyMatcher = MyPattern.matcher(InputString);&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;if&lt;/span&gt; (!MyMatcher.matches()) {&lt;br /&gt;&lt;span class="rem"&gt;// invalid, do something&lt;/span&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;Some more examples on validations:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="samples"&gt;&lt;br /&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 300px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;// to validate a password&lt;/span&gt;&lt;br /&gt;String RegualrExpression_Password = &lt;span class="str"&gt;'((?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*[@#$%]).{6,20})'&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;//image file extention&lt;/span&gt;&lt;br /&gt;String RegualrExpression_ImgFileExt = &lt;span class="str"&gt;'([^\s]+(\.(?i)(jpg|png|gif|bmp))$)'&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;//to validate an IP Address&lt;/span&gt;&lt;br /&gt;String RE_IP = &lt;span class="str"&gt;'^([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])\\.([01]?\\d\\d?|2[0-4]\\d|25[0-5])$'&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;//date format (dd/mm/yyyy)&lt;/span&gt;&lt;br /&gt;String RE_date = &lt;span class="str"&gt;'(0?[1-9]|[12][0-9]|3[01])/(0?[1-9]|1[012])/((19|20)\\d\\d)'&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;//to match links tag "A" in HTML&lt;/span&gt;&lt;br /&gt;String RE_ATags = &lt;span class="str"&gt;'(?i)&amp;lt;a([^&amp;gt;]+)&amp;gt;(.+?)&amp;lt;/a&amp;gt;'&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;Another way that you can benefit from the Matcher class to to reformat the string.&lt;br /&gt;&lt;br /&gt;Below is an example that shows you, how you can strip the HTML tags from a string and extract the plain text. This is very useful when you want to record email contents into Salesforce or covert the HTML version of an email into it's plain text counterpart.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="border: 1px solid rgb(204, 204, 204); padding: 2px; overflow: auto; width: 98%; height: 350px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; html = 'your html code';&lt;br /&gt; //first replace all &amp;lt;BR&amp;gt; tags with \n to support new lines&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; result = html.replaceAll(&lt;span class="str"&gt;'&amp;lt;br/&amp;gt;'&lt;/span&gt;, &lt;span class="str"&gt;'\n'&lt;/span&gt;);&lt;br /&gt;result = result.replaceAll(&lt;span class="str"&gt;'&amp;lt;br /&amp;gt;'&lt;/span&gt;, &lt;span class="str"&gt;'\n'&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;//regular expression to match all HTML/XML tags&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;string&lt;/span&gt; HTML_TAG_PATTERN = &lt;span class="str"&gt;'&amp;lt;.*?&amp;gt;'&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;// compile the pattern     &lt;/span&gt;&lt;br /&gt;pattern myPattern = pattern.compile(HTML_TAG_PATTERN);&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;// get your matcher instance&lt;/span&gt;&lt;br /&gt;matcher myMatcher = myPattern.matcher(result);&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;//remove the tags     &lt;/span&gt;&lt;br /&gt;result = myMatcher.replaceAll(&lt;span class="str"&gt;''&lt;/span&gt;);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;For complete reference of Java regular expressions please refer to: &lt;a href="http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html" target="_blank"&gt;here&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-5452143958417863160?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/AA6tYk0GFW54M0Hjy3rYIzlSibI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AA6tYk0GFW54M0Hjy3rYIzlSibI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/AA6tYk0GFW54M0Hjy3rYIzlSibI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AA6tYk0GFW54M0Hjy3rYIzlSibI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/DvEJsdLBglE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/5452143958417863160/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2010/01/utilizing-apex-pattern-and-matcher.html#comment-form" title="15 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/5452143958417863160?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/5452143958417863160?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/DvEJsdLBglE/utilizing-apex-pattern-and-matcher.html" title="Utilizing Apex Pattern and Matcher Classes" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>15</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2010/01/utilizing-apex-pattern-and-matcher.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0UFSXwyeSp7ImA9WxBRE00.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-2255577416083830226</id><published>2009-12-31T17:23:00.003-05:00</published><updated>2009-12-31T18:13:38.291-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-12-31T18:13:38.291-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Apex Code" /><title>Flex Rich Clients and Complex Logics!</title><content type="html">Nowadays many developers are driven or forced toward using richer UIs such as Adobe Flex by their customers.  Using Adobe Flex and AIR technologies you can create fancy user interfaces with drag and drop functionality, applications that easily integrates with force.com Webservice APIs, takes the data offline and syncs it back to the source once connected to internet again.&lt;br /&gt;&lt;br /&gt;All that is very interesting and cool, however one should bear in mind that all the operations, Web Service calls, etc are running in the user's browser (client machine) not on force.com servers.&lt;br /&gt;&lt;br /&gt;For this very specific reason, one has to consider how to best design the applications to utilize the cloud computing power of force.com technology and leave the chunk of heavy operations (program logic) out of the client's machine.&lt;br /&gt;&lt;br /&gt;The following example which is proven to be useless in the real world, shows you how to host your main operations (chunk of code) in the force.com platform and then share them in form of Web Service methods with your flex applications.&lt;br /&gt;&lt;br /&gt;I first start with creating a new Apex class which is pretty much the same as any other Apex class  you have seen before but with a few minor changes.&lt;br /&gt;&lt;br /&gt;The Apex class is where I intend to do my main operation. I'd rather use my Flex application to utilize such Apex classes and merely view the data in proper form to the user (where possible).&lt;br /&gt;&lt;br /&gt;Points:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Any Apex class which wants to share a method over the web needs to be marked as "global"&lt;/li&gt;&lt;li&gt;Any method of this class that must be reachable by our Flex app should be mark as "WebService"&lt;/li&gt;&lt;li&gt;Any internal variable or class that are used in the parameter or as output of the WebService methods also needs to be marked as "WebService".&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Below is the implementation of a sample Apex class which shares a method as "WebService".&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="apexclass"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;global &lt;span class="kwrd"&gt;class&lt;/span&gt; MyWebService&lt;br /&gt;{&lt;br /&gt;global &lt;span class="kwrd"&gt;class&lt;/span&gt; CompositeData&lt;br /&gt;{&lt;br /&gt;   WebService String CompanyName;&lt;br /&gt;   WebService String FullName;&lt;br /&gt;   WebService String Id;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Webservice &lt;span class="kwrd"&gt;static&lt;/span&gt; MyWebService.CompositeData[] SearchContacts(String keywords)&lt;br /&gt;{&lt;br /&gt;   List&amp;lt;CompositeData&amp;gt; results = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;CompositeData&amp;gt;();&lt;br /&gt;&lt;br /&gt;   &lt;span class="rem"&gt;//search logic.&lt;/span&gt;&lt;br /&gt;   List&amp;lt;List&amp;lt;SObject&amp;gt;&amp;gt; data = [Find :keywords IN ALL FIELDS&lt;br /&gt;     RETURNING Contact (id, Name, Account.Name)];&lt;br /&gt;&lt;br /&gt;   List&amp;lt;SObject&amp;gt; contacts = data[0];&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;for&lt;/span&gt;(SObject contact : contacts)&lt;br /&gt;   {&lt;br /&gt;       CompositeData cd = &lt;span class="kwrd"&gt;new&lt;/span&gt; CompositeData();&lt;br /&gt;    &lt;br /&gt;       cd.Id = contact.Id;&lt;br /&gt;       cd.FullName = ((Contact)contact).Name;&lt;br /&gt;       cd.CompanyName = ((Contact)contact).Account.Name;&lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;       results.add(cd);&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;return&lt;/span&gt; results;&lt;br /&gt;}&lt;br /&gt;} &lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;The above example demonstrates how you can share a such class as structure other than Apex's SObject class.&lt;br /&gt;&lt;br /&gt;This allows you to run multiple queries and aggregate data from various objects in force.com platform and then return them back to the Flex application using the new structure ("CompositeData" in this example).&lt;br /&gt;&lt;br /&gt;Now let's see how we can use the above method in our Flex application. Let's say that we use a Flex wrapper class to call this Apex method and then expose this class (Flex class) to our Flex application.&lt;br /&gt;&lt;br /&gt;I believe the comments in the code should guide you through the steps.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;package com&lt;br /&gt;{&lt;br /&gt;  import com.salesforce.AsyncResponder;&lt;br /&gt;  import com.salesforce.Connection;&lt;br /&gt;  import com.salesforce.objects.Parameter;&lt;br /&gt;  import com.salesforce.results.Fault;&lt;br /&gt;&lt;br /&gt;  import mx.collections.ArrayCollection;&lt;br /&gt;  import mx.controls.Alert;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; MyFlexWebServiceClient&lt;br /&gt;  {&lt;br /&gt;    &lt;br /&gt;      &lt;span class="rem"&gt;//a public property to provide access to the final results&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;public&lt;/span&gt; var results : ArrayCollection;&lt;br /&gt;    &lt;br /&gt;      &lt;span class="rem"&gt;//force.com connection object&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;private&lt;/span&gt; var binding : Connection;&lt;br /&gt;    &lt;br /&gt;      &lt;span class="rem"&gt;//the class constructor &lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;public&lt;/span&gt; function MyFlexWebServiceClient()&lt;br /&gt;      {&lt;br /&gt;          results = &lt;span class="kwrd"&gt;new&lt;/span&gt; ArrayCollection();&lt;br /&gt;      }&lt;br /&gt;    &lt;br /&gt;      &lt;span class="rem"&gt;// this method will be called from the Flex application script&lt;/span&gt;&lt;br /&gt;      &lt;span class="rem"&gt;// section once it is instantiated&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;public&lt;/span&gt; function init(Connection sfdcConnection)&lt;br /&gt;      {&lt;br /&gt;          &lt;span class="rem"&gt;//the class receive the SFDC connection object from the parent application&lt;/span&gt;&lt;br /&gt;          &lt;span class="kwrd"&gt;this&lt;/span&gt;.binding = sfdcConnection;&lt;br /&gt;        &lt;br /&gt;          &lt;span class="kwrd"&gt;if&lt;/span&gt; (!&lt;span class="kwrd"&gt;this&lt;/span&gt;.binding.IsLoggedIn)&lt;br /&gt;           &lt;span class="kwrd"&gt;throw&lt;/span&gt; &lt;span class="kwrd"&gt;new&lt;/span&gt; Error(&lt;span class="str"&gt;"Connection to the server is not available."&lt;/span&gt;);&lt;br /&gt;      }&lt;br /&gt;    &lt;br /&gt;      &lt;span class="rem"&gt;//this method is the wrapper method that calls the force.com webservice &lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;public&lt;/span&gt; function execute(keywords: String): &lt;span class="kwrd"&gt;void&lt;/span&gt;&lt;br /&gt;      {&lt;br /&gt;          &lt;span class="rem"&gt;//validation&lt;/span&gt;&lt;br /&gt;          &lt;span class="kwrd"&gt;if&lt;/span&gt; (keywords == &lt;span class="kwrd"&gt;null&lt;/span&gt; || keywords.length &amp;lt;= 0)&lt;br /&gt;          {&lt;br /&gt;              &lt;span class="rem"&gt;//handle the invalid data&lt;/span&gt;&lt;br /&gt;              &lt;span class="kwrd"&gt;return&lt;/span&gt;;&lt;br /&gt;          }   &lt;br /&gt;        &lt;br /&gt;          &lt;span class="rem"&gt;//preparing the parameters of the web service method&lt;/span&gt;&lt;br /&gt;          var &lt;span class="kwrd"&gt;params&lt;/span&gt; : Array = &lt;span class="kwrd"&gt;new&lt;/span&gt; Array(1);&lt;br /&gt;           &lt;br /&gt;          var param1 : com.salesforce.objects.Parameter = &lt;span class="kwrd"&gt;new&lt;/span&gt; Parameter(&lt;span class="str"&gt;"keywords"&lt;/span&gt;, keywords);&lt;br /&gt;          &lt;span class="kwrd"&gt;params&lt;/span&gt;[0] = param1;&lt;br /&gt;        &lt;br /&gt;          &lt;span class="rem"&gt;// using SFDC Aysync Responder to get the results in flex&lt;/span&gt;&lt;br /&gt;          var tempCallBack: AsyncResponder = &lt;span class="kwrd"&gt;new&lt;/span&gt; AsyncResponder(&lt;br /&gt;          function(result:Object):&lt;span class="kwrd"&gt;void&lt;/span&gt; {&lt;br /&gt;            &lt;br /&gt;              &lt;span class="kwrd"&gt;if&lt;/span&gt; (result != &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;br /&gt;                &lt;span class="kwrd"&gt;this&lt;/span&gt;.results = result &lt;span class="kwrd"&gt;as&lt;/span&gt; ArrayCollection;&lt;br /&gt;              &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;                Alert.show(&lt;span class="str"&gt;"Result is empty."&lt;/span&gt;, &lt;span class="str"&gt;"Info"&lt;/span&gt;);&lt;br /&gt;          },&lt;br /&gt;          function(result: Fault):&lt;span class="kwrd"&gt;void&lt;/span&gt; { Alert.show(&lt;span class="str"&gt;"Operation failed"&lt;/span&gt;, &lt;span class="str"&gt;"Error"&lt;/span&gt;);  }&lt;br /&gt;          );&lt;br /&gt;        &lt;br /&gt;          &lt;span class="rem"&gt;// call the execute method of the SFDC connection object to reach out the web service&lt;/span&gt;&lt;br /&gt;          binding.execute(&lt;span class="str"&gt;"MyWebService"&lt;/span&gt;, &lt;span class="str"&gt;"SearchContacts"&lt;/span&gt;, &lt;span class="kwrd"&gt;params&lt;/span&gt;, tempCallBack);&lt;br /&gt;        &lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;Happy holidays and new year!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-2255577416083830226?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/jps-2rhKMpTOHfuynsyZxqscoHI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jps-2rhKMpTOHfuynsyZxqscoHI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/jps-2rhKMpTOHfuynsyZxqscoHI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/jps-2rhKMpTOHfuynsyZxqscoHI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/yQtMdfD3oA4" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/2255577416083830226/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2009/12/flex-rich-clients-and-complex-logics.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/2255577416083830226?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/2255577416083830226?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/yQtMdfD3oA4/flex-rich-clients-and-complex-logics.html" title="Flex Rich Clients and Complex Logics!" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2009/12/flex-rich-clients-and-complex-logics.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQMQXo6eyp7ImA9WxNQE00.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-1740793874342657784</id><published>2009-09-18T10:11:00.003-04:00</published><updated>2009-09-18T15:49:40.413-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-18T15:49:40.413-04:00</app:edited><title>Salesforce.com Winter 10 Release...What's in it for you?</title><content type="html">This Tuesday, Salesforce.com announced the release of Winter 10 version and explored new features that soon will be added to the mix. Right off the bat I would like to declare that this new release has a lot of more to offer compare to the previous one and I thank Salesforce for that!&lt;br /&gt;&lt;br /&gt;The highlight of the new features is the Realtime Quotes that will be available soon to all Salesforce.com customers. In any sales environment one of the aspects of the Sales process is to be able to track what goods potential and existing customers are interested to purchase and Salesforce supports that by the means of Opportunities.&lt;br /&gt;&lt;br /&gt;The one thing that always bugged me though was that Salesforce did not have a feature to allow communication of that information (in terms of Quotes or Invoices) to those customers as soon as the deals reached to a more solid state (proposing or closing).&lt;br /&gt;&lt;br /&gt;I believe Salesforce is very late in the game to introduce this feature and already many customers have sought other means to fill that gap and now most will face the question whether to migrate the existing solutions to what's provided out-of-the-box or stay with their current vendors...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/FcO-8AJYzBA&amp;amp;rel=0&amp;amp;color1=0xb1b1b1&amp;amp;color2=0xcfcfcf&amp;amp;hl=en&amp;amp;feature=player_embedded&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/FcO-8AJYzBA&amp;amp;rel=0&amp;amp;color1=0xb1b1b1&amp;amp;color2=0xcfcfcf&amp;amp;hl=en&amp;amp;feature=player_embedded&amp;amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;Also the fact that Salesforce PriceBooks are not customizable hinders the possibility of tailoring Salesforce to any specific pricing calculation model. Concepts such as automated Volume Discounts calculation that could be applied to Opportunity line items, or any other custom pricing models.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Moving on, on the Custom Cloud side, Salesforce yet again is gaining momentum by introducing "Batch Code Processor" and "Code Scheduler".&lt;br /&gt;Many admins in the past, in order to process event-driven data to  be able to provide custom roll-ups,  Analytics and better summary-data visibility of child objects in the system, were forced to max out their workflow rules or develop triggers which most of the time would hit the Governing Limits or just fail in bulk DML operations.&lt;br /&gt;&lt;br /&gt;&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/V6SuIFbNy9o&amp;amp;rel=0&amp;amp;color1=0xb1b1b1&amp;amp;color2=0xcfcfcf&amp;amp;hl=en&amp;amp;feature=player_embedded&amp;amp;fs=1"&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;param name="allowScriptAccess" value="always"&gt;&lt;embed src="http://www.youtube.com/v/V6SuIFbNy9o&amp;amp;rel=0&amp;amp;color1=0xb1b1b1&amp;amp;color2=0xcfcfcf&amp;amp;hl=en&amp;amp;feature=player_embedded&amp;amp;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;With these new features many of those scenarios can be easily addressed and even more complex logic can be applied to solve problems and fulfill business requirements!&lt;br /&gt;Cases such as data de-dupping, data heath checks, rebuilding account hierarchies.... Sky is the limit!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-1740793874342657784?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4qvl13qz8HpGr23N_zkm4_osg2Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4qvl13qz8HpGr23N_zkm4_osg2Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/4qvl13qz8HpGr23N_zkm4_osg2Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4qvl13qz8HpGr23N_zkm4_osg2Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/BQ6Xnwu_Eb0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/1740793874342657784/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2009/09/salesforcecom-winter-10-releasewhats.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1740793874342657784?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1740793874342657784?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/BQ6Xnwu_Eb0/salesforcecom-winter-10-releasewhats.html" title="Salesforce.com Winter 10 Release...What's in it for you?" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2009/09/salesforcecom-winter-10-releasewhats.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUQCRnw7eSp7ImA9WxNQE00.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-3115871938538755377</id><published>2009-09-12T14:03:00.006-04:00</published><updated>2009-09-18T15:49:27.201-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-18T15:49:27.201-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>Edit and Delete Command For Your Datatable In Visualforce</title><content type="html">&lt;div style="text-align: center;"&gt;&lt;span class="Apple-style-span"  style="color:#0000EE;"&gt;&lt;span class="Apple-style-span" style="text-decoration: underline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;Most often that not you need to show data to the users in form of a table, such as Salesforce List Views or Related Lists. &lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Visualforce allows us to easily implement such page with a few lines of code.  However, most often you would want to be able to add more interactivity/functionality to your page  by supporting Edit or Delete command or any other custom operation that is required by design.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Today's article will show you how you can get that working for you.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_A3gbIRtV9H8/SqvzcaURlVI/AAAAAAAAAUU/JXPJTJagCt4/s1600-h/datatable_editdelete.JPG"&gt;&lt;img src="http://4.bp.blogspot.com/_A3gbIRtV9H8/SqvzcaURlVI/AAAAAAAAAUU/JXPJTJagCt4/s400/datatable_editdelete.JPG" border="0" alt="" id="BLOGGER_PHOTO_ID_5380661849250436434" style="display: block; margin-top: 0px; margin-right: auto; margin-bottom: 10px; margin-left: auto; text-align: center; cursor: pointer; width: 400px; height: 134px; " /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Above picture depicts how the final result will look like, very much like Salesforce.com standard pages, isn't it?.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this example I list the first twenty Account records that Apex finds and show then on the screen and then I would like to have actions such as "Edit" that forwards the user to Account edit page and brings the user back to my page again after the modifications are done and also "Delete" action that receives a confirmation from user and removes an Account record from Salesforce CRM.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So let's talk about the User Interface (UI) components required first and then we will look into the controller's code to see how it all works together.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Steps to add the page tags:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;I first add a PageBlock component and set the title to "Accounts"&lt;/li&gt;&lt;li&gt;Then I want to put a PageBlockDataTable in the my Visualforce page.&lt;/li&gt;&lt;li&gt;In this step I simply add all the data columns I want to show to the user and leave the first column empty for the next step.&lt;/li&gt;&lt;li&gt;Now we are ready to add the action items to the first column of the dataTable.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Below is the page tags that I have used to make it all happen:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;b:includable id="visualforce"&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;controller&lt;/span&gt;&lt;span class="kwrd"&gt;="DataTableEditRemoveController"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="form"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Accounts"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!accs}"&lt;/span&gt; &lt;span class="attr"&gt;var&lt;/span&gt;&lt;span class="kwrd"&gt;="row"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="/{!row.id}/e?retURL=/apex/{!$CurrentPage.Name}"&lt;/span&gt; &lt;span class="attr"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;="font-weight:bold"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Edit&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;span class="attr"&gt;&amp;amp;nbsp;&lt;/span&gt;|&lt;span class="attr"&gt;&amp;amp;nbsp;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;a&lt;/span&gt; &lt;span class="attr"&gt;href&lt;/span&gt;&lt;span class="kwrd"&gt;="javascript:if (window.confirm('Are you sure?')) DeleteAccount('{!row.Id}');"&lt;/span&gt; &lt;span class="attr"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;="font-weight:bold"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Del&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;a&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!row.Name}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!row.BillingStreet}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!row.BillingCity}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!row.BillingPostalCode}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!row.BillingCountry}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:actionFunction&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="{!DeleteAccount}"&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="DeleteAccount"&lt;/span&gt; &lt;span class="attr"&gt;reRender&lt;/span&gt;&lt;span class="kwrd"&gt;="form"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:param&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="accountid"&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;assignTo&lt;/span&gt;&lt;span class="kwrd"&gt;="{!SelectedAccountId}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:actionFunction&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div&gt;&lt;b&gt;How It Is Done For Edit Action:&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Since the standard Account edit page is good enough for me I used an outputLink component to link the record to its Standard Edit page. In Salesforce for standard objects you can follow this format to get the URL for their edit page: /{RecordId}/e&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I also wanted this to work in such a way that would return the user back to my Visualforce page once the user clicks on "save" or "cancel" in the Account edit page. In order to do that I need to add the following to the URL: /{RecordId}/e?retURL={returnURL}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In the Page's source code (above) you see that for return URL I have used {!$CurrentPage.Name} merge field, where I could simply put my page name. I like writing code clean! By doing this if you later on decided to change your page name, you do not need to worry about breaking anything! You page will continue to work with no problems!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;b&gt;How It Is Done For Delete Action:&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to support this action in your page you need to do a bit of coding. The key is to be able to find out which account was selected by the user to be deleted.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In this example I have used a actionFunction component that triggers a Controller's Apex method call "DeleteAccount". &lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Before getting more into the coding part I wanted this link to get a confirmation from the user about deleting the record before actually we remove it.&lt;/div&gt;&lt;div&gt;In order to do so, we need to use a little bit of Javascript "window.confirm", the javascript function returns true if the user clicks on OK and false if the user selects "Cancel".&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;In order to capture the user's selection as to which account should be deleted I have added a "param" tag to the actionFunction component which passes the Account ID to the controller and as soon as user clicks on the link.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Now let's take a look at the code:&lt;/div&gt;&lt;b:includable id="code"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; DataTableEditRemoveController {&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Account&amp;gt; accs { get; set; }&lt;br /&gt;  &lt;br /&gt;   &lt;span class="rem"&gt;//used to get a hold of the account record selected for deletion&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; SelectedAccountId { get; set; }&lt;br /&gt;  &lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; DataTableEditRemoveController() {&lt;br /&gt;       &lt;span class="rem"&gt;//load account data into our DataTable&lt;/span&gt;&lt;br /&gt;       LoadData();&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; LoadData() {&lt;br /&gt;       accs = [Select id, name, BillingStreet, BillingCity, BillingPostalCode, BillingCountry from Account limit 20];&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; DeleteAccount()&lt;br /&gt;   {&lt;br /&gt;      &lt;span class="rem"&gt;// if for any reason we are missing the reference &lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;if&lt;/span&gt; (SelectedAccountId == &lt;span class="kwrd"&gt;null&lt;/span&gt;) {&lt;br /&gt;      &lt;br /&gt;         &lt;span class="kwrd"&gt;return&lt;/span&gt;;&lt;br /&gt;      }&lt;br /&gt;     &lt;br /&gt;      &lt;span class="rem"&gt;// find the account record within the collection&lt;/span&gt;&lt;br /&gt;      Account tobeDeleted = &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;      &lt;span class="kwrd"&gt;for&lt;/span&gt;(Account a : accs)&lt;br /&gt;       &lt;span class="kwrd"&gt;if&lt;/span&gt; (a.Id == SelectedAccountId) {&lt;br /&gt;          tobeDeleted = a;&lt;br /&gt;          &lt;span class="kwrd"&gt;break&lt;/span&gt;;&lt;br /&gt;       }&lt;br /&gt;      &lt;br /&gt;      &lt;span class="rem"&gt;//if account record found delete it&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;if&lt;/span&gt; (tobeDeleted != &lt;span class="kwrd"&gt;null&lt;/span&gt;) {&lt;br /&gt;       Delete tobeDeleted;&lt;br /&gt;      }&lt;br /&gt;     &lt;br /&gt;      &lt;span class="rem"&gt;//refresh the data&lt;/span&gt;&lt;br /&gt;      LoadData();&lt;br /&gt;   }    &lt;br /&gt;  &lt;br /&gt;  &lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div&gt;Funny thing is that in my tests if you do not set the "reRender" attribute of the "actionFunnction"  component the param is not passed to the controller and the "SelectedAccountId" property is not populated. Go figure....&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also I really wanted to get it working with commandLink or commandButton components instead using actionFucntion and javascript, but was not so lucky!&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Enjoy!&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-3115871938538755377?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/A5OGMPtUsTwB03bF3CkR3Jn41uw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/A5OGMPtUsTwB03bF3CkR3Jn41uw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/A5OGMPtUsTwB03bF3CkR3Jn41uw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/A5OGMPtUsTwB03bF3CkR3Jn41uw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/rtnkmI3sXi8" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/3115871938538755377/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2009/09/edit-and-delete-command-for-your.html#comment-form" title="19 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/3115871938538755377?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/3115871938538755377?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/rtnkmI3sXi8/edit-and-delete-command-for-your.html" title="Edit and Delete Command For Your Datatable In Visualforce" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_A3gbIRtV9H8/SqvzcaURlVI/AAAAAAAAAUU/JXPJTJagCt4/s72-c/datatable_editdelete.JPG" height="72" width="72" /><thr:total>19</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2009/09/edit-and-delete-command-for-your.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkMNQ3c5fip7ImA9WxNRF0o.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-828553597699076825</id><published>2009-06-29T11:38:00.005-04:00</published><updated>2009-09-12T14:01:32.926-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-09-12T14:01:32.926-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Apex Code" /><title>Triggering an Apex method with a Custom Button</title><content type="html">Most often Salesforce.com developers want to write a custom logic such as sending a notification email, changing the status of a record (picklist), etc once a button is clicked on, in a standard layout.&lt;br /&gt;&lt;br /&gt;The effort is minimized this way since you do not want to recreate the layout using a Visualforce page, all you need is to be able to launch a method once the button is clicked on.&lt;br /&gt;&lt;br /&gt;In order to do so, you need to write your logic into an Apex class with following conditions:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Firstly, your class should be marked as "Global"&lt;/li&gt;&lt;li&gt;Secondly, the logic goes to a static method of this class which is marked as "WebService"&lt;/li&gt;&lt;/ol&gt;If an Apex class has the above characteristics, the method marked as web service can be called via javascript when the button is clicked on. Neat!&lt;br /&gt;&lt;br /&gt;I think by now you have a good idea of where I am going with this, so let's dive into code and examine everything more closely.&lt;br /&gt;&lt;br /&gt;Below I have created a Apex Class called "OutboundEmails" and added a method that has a keyword as "WebService".&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;global &lt;span class="kwrd"&gt;class&lt;/span&gt; OutboundEmails {&lt;br /&gt;&lt;br /&gt;WebService &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; SendEmailNotification(&lt;span class="kwrd"&gt;string&lt;/span&gt; id) {&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;//create a mail object to send a single email.&lt;/span&gt;&lt;br /&gt;Messaging.SingleEmailMessage mail = &lt;span class="kwrd"&gt;new&lt;/span&gt; Messaging.SingleEmailMessage();&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;//set the email properties&lt;/span&gt;&lt;br /&gt;mail.setToAddresses(&lt;span class="kwrd"&gt;new&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt;[] {&lt;span class="str"&gt;'myemail@domain.com'&lt;/span&gt;});&lt;br /&gt;mail.setSenderDisplayName(&lt;span class="str"&gt;'SF.com Email Agent'&lt;/span&gt;);&lt;br /&gt;mail.setSubject(&lt;span class="str"&gt;'A new reminder'&lt;/span&gt;);&lt;br /&gt;mail.setHtmlBody(&lt;span class="str"&gt;'an object with ID='&lt;/span&gt;+ id + &lt;span class="str"&gt;' is just clicked on.'&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;//send the email&lt;/span&gt;&lt;br /&gt;Messaging.sendEmail(&lt;span class="kwrd"&gt;new&lt;/span&gt; Messaging.SingleEmailMessage[] { mail } );&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;This method receives an object Id (this is just to demo purposes, so you can identify any parameters that you need) and sends an email notification subsequently once the method is called.&lt;br /&gt;&lt;br /&gt;Now let's concentrate on the button that will actually call our WebService method.&lt;br /&gt;&lt;br /&gt;Firstly, I create a detail page button let's say on Account object and name it "Send Me ID".&lt;br /&gt;This button's behavior will be "Execute Javascript".&lt;br /&gt;If you need more information about how you can add a custom button to Account object please click &lt;a href="http://salesforcesource.blogspot.com/2008/09/how-add-detail-button-to-your-objects.html"&gt;here&lt;/a&gt;. Then I add the following code to the body of the button edit page:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="button"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 200px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;{!REQUIRESCRIPT(&lt;span class="str"&gt;"/soap/ajax/10.0/connection.js"&lt;/span&gt;)}&lt;br /&gt;{!REQUIRESCRIPT(&lt;span class="str"&gt;"/soap/ajax/10.0/apex.js"&lt;/span&gt;)}&lt;br /&gt;sforce.apex.execute(&lt;span class="str"&gt;"OutboundEmails"&lt;/span&gt;,&lt;span class="str"&gt;"SendEmailNotification"&lt;/span&gt;, {id:&lt;span class="str"&gt;"{!Account.Id}"&lt;/span&gt;});&lt;br /&gt;window.alert(&lt;span class="str"&gt;"Account Id is sent."&lt;/span&gt; );&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;Now It all works together!&lt;br /&gt;Once you click on the button, in case you have not forgotten to change the sample email address with your own in the code, you should receive the email.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-828553597699076825?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/caI3Ixi3FSZqnIPbTMeX6jNbDiQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/caI3Ixi3FSZqnIPbTMeX6jNbDiQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/caI3Ixi3FSZqnIPbTMeX6jNbDiQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/caI3Ixi3FSZqnIPbTMeX6jNbDiQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/G83LELwKemk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/828553597699076825/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2009/06/triggering-apex-method-with-custom.html#comment-form" title="25 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/828553597699076825?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/828553597699076825?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/G83LELwKemk/triggering-apex-method-with-custom.html" title="Triggering an Apex method with a Custom Button" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>25</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2009/06/triggering-apex-method-with-custom.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkcNQHc-fCp7ImA9WxVaGEw.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-1573592135522677248</id><published>2009-04-07T19:41:00.007-04:00</published><updated>2009-04-15T11:41:31.954-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-04-15T11:41:31.954-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>How to Create Word, PDF or Excel Files with Salesforce Data</title><content type="html">One of challenges in any software application is being able to export data into different documents using templates for various purposes.&lt;br /&gt;&lt;br /&gt;An example of this is using such templates to create custom documents such as Fax sheets, Quotes, Invoices, Forms that are required to be filled out by a person in traditional ways.&lt;br /&gt;&lt;br /&gt;Visualforce pages allow us to generate such documents combined with Salesfoce data. The documents can be formatted in number of types such as PDF, Excel, Word, HTML or XML.&lt;br /&gt;&lt;br /&gt;In this example I will show how easy it is to generate PDF documents using Visualforce pages adn with adding little bit of your coding skills you can easily create other formats as well (of course with certain limitations).&lt;br /&gt;&lt;br /&gt;In order to be able to create PDF pages in Salesforce you meed to know the following:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;When using the Page tag, you should set the "showHeader" attribute to "false". By doing this you are telling to Visualforce to do not render any Salesforce header or even HTML tags.&lt;br /&gt;So think about a normal HTML page, which has tags such as "html", "head" and "body" none of these tags are added to your page automatically anymore. So we should add them to the page ourselves when creating PDF files.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Also note that HTML form elements or Apex input controls can not be included into your document.&lt;/li&gt;&lt;li&gt;The other important thing is styling, in order to make your PDF file look professional you need to apply styling skills and add CSS classes to your Visualforce page.&lt;/li&gt;&lt;li&gt;And the last point is to set your "Page" attribute called "renderAs" to "pdf".&lt;/li&gt;&lt;/ul&gt;Below is a sample PDF generate code with no content:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="code1"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 200px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;showHeader&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;renderAs&lt;/span&gt;&lt;span class="kwrd"&gt;="pdf"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;The next step is to add some styling/formatting options as well as planning for your content.&lt;br /&gt;&lt;br /&gt;By applying CSS into you can define a few CSS classes that formats your PDF document the way you need.&lt;br /&gt;&lt;br /&gt;However, the following are important features you may want to benefit from, such as the ability   to set the PDF file pages orientation (Landscape or portrait), allow page numbers or additional descriptions in PDF file's header or footer, etc.&lt;br /&gt;&lt;br /&gt;Some of these examples are shown below:&lt;br /&gt;&lt;b:includable id="code2"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;showHeader&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;renderAs&lt;/span&gt;&lt;span class="kwrd"&gt;="pdf"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;style&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="text/css"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  @page&lt;br /&gt;  {&lt;br /&gt;&lt;br /&gt;    /* Landscape orientation */&lt;br /&gt;    size:landscape;&lt;br /&gt;&lt;br /&gt;    /* Put page numbers in the bottom right corner of each&lt;br /&gt;    page in the pdf document. */&lt;br /&gt;    @bottom-right {&lt;br /&gt;      content: "Page " counter(page);&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  body {&lt;br /&gt;   font-family: Arial Unicode MS;&lt;br /&gt;   font-size:9pt;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  td {&lt;br /&gt;    font-size:11pt;&lt;br /&gt;    font-family:Tahoma;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  /* you can even define custom classes that utilize your static resources */&lt;br /&gt;  .checkbox&lt;br /&gt;  {&lt;br /&gt;     width: 19px;&lt;br /&gt;     height: 16px;&lt;br /&gt;     background-image:url({!URLFOR($Resource.Checkbox)});&lt;br /&gt;     background-repeat: no-repeat;&lt;br /&gt;  }&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;head&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;body&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt; If your requirement is to create Word or Excel files the process would be the same only following changes are required:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Remove "renderAs" attribute&lt;/li&gt;&lt;li&gt;Add a new attribute to the page tag: "ContentType":&lt;br /&gt;    - For Word: contentType="application/msword"&lt;br /&gt;    - For Excel: contentType="application/x-excel"&lt;/li&gt;&lt;li&gt;And finally a little bit of tweaking of your style will take care of the job&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-1573592135522677248?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0ASaz1-Wly6XDuG9HMbNBs4LtcA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0ASaz1-Wly6XDuG9HMbNBs4LtcA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0ASaz1-Wly6XDuG9HMbNBs4LtcA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0ASaz1-Wly6XDuG9HMbNBs4LtcA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/uiRfYKugVTw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/1573592135522677248/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2009/04/how-to-create-word-pdf-or-excel-files.html#comment-form" title="44 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1573592135522677248?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1573592135522677248?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/uiRfYKugVTw/how-to-create-word-pdf-or-excel-files.html" title="How to Create Word, PDF or Excel Files with Salesforce Data" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>44</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2009/04/how-to-create-word-pdf-or-excel-files.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkIGR385fip7ImA9WxVREU4.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-4618145657974743673</id><published>2009-01-16T11:47:00.003-05:00</published><updated>2009-01-16T13:28:46.126-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-16T13:28:46.126-05:00</app:edited><title>Spring 09 Release - A Whole New Force.com or Just a Few New Goodies?</title><content type="html">After attending the Spring 09 Release the other day in hope of seeing at least some of the good ideas making way to force.com platform, features such as inline editing for Visualforce pages, more flexibility with custom of related-lists, flexibility on using the advanced Apex features to create customized reports and dashboards, etc  following observations were concluded:&lt;br /&gt;&lt;br /&gt;Well not all of them made it! in fact, we can summarized the release merely around some enhancements here and there in the platform.&lt;br /&gt;&lt;br /&gt;Some of you would even think that in this economic downturn, one can not expect more than this from IT companies. Should this thought ever cross our minds, I would not rule this factor out as an impact on this release!&lt;br /&gt;&lt;br /&gt;Let's have a look and quickly browse through the enhancements of the Spring 09 release:&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Force.com Sites Improvements&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Audit Trail&lt;/span&gt;:&lt;br /&gt;Now you can track all the changes made to your sites by different users.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Sites Robot.txt and Fav Icon&lt;/span&gt;:&lt;br /&gt;With this release you will be able to set a robot.txt for you force.com site which enables you to better control how search engines should index your site's pages. Fav Icon is also a useful way of personalizing the browser in showing an icon next to the title of your website (in tabs) and also in favorites/bookmarks.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Standard Pages&lt;/span&gt;:&lt;br /&gt;Allows you to bring selected standard pages and expose them to the public via your force.com site (suitable for ideas page, etc).&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Sites Packaging&lt;/span&gt;:&lt;br /&gt;With this feature we can package force.com sites, apex code, etc and install them into other instances.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Force.com Web Service API Improvements&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Improvements in the timeout limits of the callouts&lt;/span&gt;:&lt;br /&gt;This is potentially good when the code takes a longer time to process and bring back the results. Now we can configure it in a way to have extended timeout periods resulting in more run-time stability.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Also Wider range of WSDL types&lt;/span&gt; are supported by Spring 09 release.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Database and Reporting&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Summary Report Data Snapshots:&lt;/span&gt;&lt;br /&gt;Previously data snapshots were available on reports, however, with this release you can use snapshots across large amounts of data, where only the summaries will be stored, as well as create historical views of metrics, KPIs and other summary data.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Data Grouping Functions:&lt;/span&gt;&lt;br /&gt;This is actually a very useful upgrade, now you can group the entries of a report to better analyze aggregate data.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Delegated Data Administration:&lt;/span&gt;&lt;br /&gt;This feature allows you to grant permission to non-admin users to report, search, modify, transfer, share, unlock, or approve any record regardless of sharing settings on an object basis.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Dashboard Finder:&lt;/span&gt;&lt;br /&gt;This enhancement allows you to search through your dashboard items (a real time-saver!).&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Force.com IDE&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Apex Code Auto-Complete in Force.com IDE:&lt;/span&gt;&lt;br /&gt;Finally! When you are coding in Eclipse (force.com IDE) auto-complete feature will be available to assist you with writing the code.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;User Interface&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Enhanced Page Layout Editor:&lt;/span&gt;&lt;br /&gt;This one is my favorite enhancement, using this feature now you can create much better layouts. You can drag and drop fields and items around, "save as" a layout, leave a spot empty (blank spaces), design the mini-layout, etc.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Services&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Cross-Object Workflow:&lt;/span&gt;&lt;br /&gt;With this feature you can update a field on a parent record within a workflow!&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Access to Email Logs in the Application:&lt;/span&gt;&lt;br /&gt;This report shows you whether your outbound emails were received or bounced back and basically gives you a comprehensive log of your outbound emails.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/li&gt;&lt;br /&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Force.com Logic&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;New Opportunity Save Behavior&lt;/span&gt;&lt;br /&gt;Visit the &lt;a href="http://wiki.apexdevnet.com/index.php/New_Opportunity_Save_Behavior" title="New Opportunity Save Behavior" target="_blank"&gt;New Opportunity Save Behavior&lt;/a&gt; Salesforce wiki page for more information.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Mobile&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;i&gt;Mobile Web Tabs for iPhone&lt;br /&gt;&lt;/i&gt;You can now create mobile-ready Visualforce Tabs for the iPhone. This enhances the client with a near-limitless method of extension - enabling you create content for the iPhone using the Visualforce user interface framework. The hybrid iPhone client that supports this functionality will be released next month.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-4618145657974743673?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3IWOBzea0p9xEITML_7nQ-N0DXE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3IWOBzea0p9xEITML_7nQ-N0DXE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/3IWOBzea0p9xEITML_7nQ-N0DXE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3IWOBzea0p9xEITML_7nQ-N0DXE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/cmvDkCI8DNc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/4618145657974743673/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2009/01/spring-09-release-whole-new-forcecom-or.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/4618145657974743673?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/4618145657974743673?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/cmvDkCI8DNc/spring-09-release-whole-new-forcecom-or.html" title="Spring 09 Release - A Whole New Force.com or Just a Few New Goodies?" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>3</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2009/01/spring-09-release-whole-new-forcecom-or.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0AHSHw4fip7ImA9WxVSE0k.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-1451456296027426045</id><published>2009-01-07T10:35:00.006-05:00</published><updated>2009-01-07T11:28:59.236-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-07T11:28:59.236-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>Allow Mass Update of your Object Records Even Without Having a Save Button!</title><content type="html">Today we want to explore one of the beauties of the Visualforce technology.&lt;br /&gt;Those who have a history of witting ASP or ASP.NET code will admit that Visualforce has made it all too simple to develop business applications.&lt;br /&gt;&lt;br /&gt;Let's say we want to be able to update several records of a certain Object all together providing ability for users to quickly make modifications and save them.&lt;br /&gt;&lt;br /&gt;This is particularly useful when the data in nature changes often and it's time consuming to do the updates on a record by record basis.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_A3gbIRtV9H8/SWTOZ5OdSdI/AAAAAAAAAIQ/fKK9JepDmcw/s1600-h/massupdate_sf.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 116px;" src="http://3.bp.blogspot.com/_A3gbIRtV9H8/SWTOZ5OdSdI/AAAAAAAAAIQ/fKK9JepDmcw/s400/massupdate_sf.JPG" alt="" id="BLOGGER_PHOTO_ID_5288578806693317074" border="0" /&gt;&lt;/a&gt;In this example, I will demonstrate a Visualforce page which has a search box through which user can search Accounts  and view a list of records where he or she can modify the information inline and then proceed to the next record without clicking on a save button of some sort!&lt;br /&gt;&lt;br /&gt;This is very much as easy of entering data into cells of an excel sheet! The only difference is that the Excel needs you to click on the save button at the end but our Visualforce page won't!&lt;br /&gt;&lt;br /&gt;I will use an actionFunction tag to create a javascript function which in turn will trigger a method of my Apex controller class. This way when the value of one the input controls changed I can call that javascript function and boom the change would get posted back to the controller and will be saved.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="pagecode"&gt;This the how Visualforce page is like:&lt;br /&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;tabStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="Account"&lt;/span&gt; &lt;span class="attr"&gt;controller&lt;/span&gt;&lt;span class="kwrd"&gt;="massAccountUpdateCon"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:sectionHeader&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Accounts Mass Update"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:sectionHeader&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="pageBlock"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="rem"&gt;&amp;lt;!-- This block will show the search textbox and the Search button --&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockButtons&lt;/span&gt; &lt;span class="attr"&gt;location&lt;/span&gt;&lt;span class="kwrd"&gt;="top"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:inputText&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!keywords}"&lt;/span&gt; &lt;span class="attr"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;="height:15px;"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:inputText&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:commandButton&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="Search"&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="{!ViewData}"&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="theButton"&lt;/span&gt; &lt;span class="attr"&gt;rerender&lt;/span&gt;&lt;span class="kwrd"&gt;="pageBlock"&lt;/span&gt; &lt;span class="attr"&gt;status&lt;/span&gt;&lt;span class="kwrd"&gt;="status"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:commandButton&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockButtons&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="rem"&gt;&amp;lt;!-- To show page level messages --&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="rem"&gt;&amp;lt;!-- The below tag will provide a javascript method which when is called in turn will call a controller's method --&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:actionFunction&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="{!UpdateRecords}"&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="updateRecords"&lt;/span&gt; &lt;span class="attr"&gt;rerender&lt;/span&gt;&lt;span class="kwrd"&gt;="pageBlock"&lt;/span&gt; &lt;span class="attr"&gt;status&lt;/span&gt;&lt;span class="kwrd"&gt;="status"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:actionFunction&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="rem"&gt;&amp;lt;!-- This table contains columns which have inputfield components --&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!accounts}"&lt;/span&gt; &lt;span class="attr"&gt;var&lt;/span&gt;&lt;span class="kwrd"&gt;="a"&lt;/span&gt; &lt;span class="attr"&gt;rendered&lt;/span&gt;&lt;span class="kwrd"&gt;="{!NOT(ISNULL(accounts))}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Name&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!a.Name}"&lt;/span&gt; &lt;span class="attr"&gt;onchange&lt;/span&gt;&lt;span class="kwrd"&gt;="updateRecords();"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Phone&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!a.Phone}"&lt;/span&gt; &lt;span class="attr"&gt;onchange&lt;/span&gt;&lt;span class="kwrd"&gt;="updateRecords();"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Billing City&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!a.BillingCity}"&lt;/span&gt; &lt;span class="attr"&gt;onchange&lt;/span&gt;&lt;span class="kwrd"&gt;="updateRecords();"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Billing Country&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!a.BillingCountry}"&lt;/span&gt; &lt;span class="attr"&gt;onchange&lt;/span&gt;&lt;span class="kwrd"&gt;="updateRecords();"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Industry&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!a.Industry}"&lt;/span&gt; &lt;span class="attr"&gt;onchange&lt;/span&gt;&lt;span class="kwrd"&gt;="updateRecords();"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- The action status to show when the AJAX postback is wroking. --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:actionStatus&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="status"&lt;/span&gt; &lt;span class="attr"&gt;startText&lt;/span&gt;&lt;span class="kwrd"&gt;="Requesting..."&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;Now the Controller, this is where the simplicity of coding can be visibly seen!&lt;br /&gt;As you can see in the Controller's source code, I do not need to write any code to find which column's value was changed! All I need to do is to update my List of Accounts!&lt;br /&gt;Visualforce will take care of all those details!&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="code"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; massAccountUpdateCon {&lt;br /&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;private&lt;/span&gt; List&amp;lt;Account&amp;gt; accounts;&lt;br /&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Account&amp;gt; getAccounts() {&lt;br /&gt;      &lt;span class="kwrd"&gt;return&lt;/span&gt; accounts;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; keywords {&lt;br /&gt;    get;&lt;br /&gt;    set;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; PageReference ViewData() {&lt;br /&gt;     &lt;span class="rem"&gt;//dynamically build the query to insertthe filter values&lt;/span&gt;&lt;br /&gt;     String query = &lt;span class="str"&gt;'Select id, name, type, ownership, industry, phone, BillingCity, billingCountry FROM account WHERE name LIKE \''&lt;/span&gt; + keywords + &lt;span class="str"&gt;'%\''&lt;/span&gt;;&lt;br /&gt;   &lt;br /&gt;     accounts = Database.query(query);&lt;br /&gt;                   &lt;br /&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; PageReference UpdateRecords() {&lt;br /&gt;    &lt;span class="rem"&gt;// this simple line of code finds out which column was changed and update the &lt;/span&gt;&lt;br /&gt;    &lt;span class="rem"&gt;// relevant account record accordingly!&lt;/span&gt;&lt;br /&gt;    update accounts;&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-1451456296027426045?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/NEUhBuUtZTY2sGbEvY9oR0oWIvE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NEUhBuUtZTY2sGbEvY9oR0oWIvE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/NEUhBuUtZTY2sGbEvY9oR0oWIvE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/NEUhBuUtZTY2sGbEvY9oR0oWIvE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/sdKByCSdOoE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/1451456296027426045/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2009/01/allow-mass-update-of-your-object.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1451456296027426045?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1451456296027426045?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/sdKByCSdOoE/allow-mass-update-of-your-object.html" title="Allow Mass Update of your Object Records Even Without Having a Save Button!" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_A3gbIRtV9H8/SWTOZ5OdSdI/AAAAAAAAAIQ/fKK9JepDmcw/s72-c/massupdate_sf.JPG" height="72" width="72" /><thr:total>9</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2009/01/allow-mass-update-of-your-object.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEEMRHs7fCp7ImA9WxVTGU8.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-4936402001803344892</id><published>2009-01-02T14:33:00.006-05:00</published><updated>2009-01-02T15:04:45.504-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-01-02T15:04:45.504-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Components" /><title>Visualforce Component to show Object Record Types</title><content type="html">&lt;span style="font-weight: bold;"&gt;Happy New Year!&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Time definitely flies and I wish you wonderful times in 2009!&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_A3gbIRtV9H8/SV5vf9kkJ5I/AAAAAAAAAII/drynhg2NuIk/s1600-h/RecordTypesList.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 138px;" src="http://4.bp.blogspot.com/_A3gbIRtV9H8/SV5vf9kkJ5I/AAAAAAAAAII/drynhg2NuIk/s400/RecordTypesList.JPG" alt="" id="BLOGGER_PHOTO_ID_5286785607474096018" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Part of our daily job is to make life easier for others by developing new applications in force.com platform. But sometimes it's not bad to spend some time for ourselves to make our own life a little easier, better and smoother.&lt;br /&gt;&lt;br /&gt;In this article I will present a Visualforce Component that would list the record types of an Object in the platform.&lt;br /&gt;&lt;br /&gt;Imagine, the Account object has two record types in the force.com platform (Record Types are created by the users based on what these objects represent on their business).&lt;br /&gt;&lt;br /&gt;Account Record types:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Customer&lt;/li&gt;&lt;li&gt;Partner&lt;/li&gt;&lt;/ul&gt;In many occasions especially when developing a new wizard you need to first allow the user select what type of record they want to create and then based on that show the correct type of interface to the user.&lt;br /&gt;&lt;br /&gt;The solution as to how you can show this to the user is rather simple, but here I actually took the time to create a re-usable component, so you and I won't need to rewrite the code next time!&lt;br /&gt;&lt;br /&gt;Here is the Component's Tags:&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 200px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:component&lt;/span&gt; &lt;span class="attr"&gt;controller&lt;/span&gt;&lt;span class="kwrd"&gt;="RecordTypeListCon"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:attribute&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="sObjectType"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="String"&lt;/span&gt; &lt;span class="attr"&gt;required&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt; &lt;span class="attr"&gt;default&lt;/span&gt;&lt;span class="kwrd"&gt;="Account"&lt;/span&gt; &lt;span class="attr"&gt;assignTo&lt;/span&gt;&lt;span class="kwrd"&gt;="{!sObjectType}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:attribute&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:attribute&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="value"&lt;/span&gt; &lt;span class="attr"&gt;description&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;type&lt;/span&gt;&lt;span class="kwrd"&gt;="String"&lt;/span&gt; &lt;span class="attr"&gt;required&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:attribute&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:selectList&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!value}"&lt;/span&gt; &lt;span class="attr"&gt;size&lt;/span&gt;&lt;span class="kwrd"&gt;="1"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:selectOptions&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!items}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:selectOptions&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:selectList&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:component&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;The Component has a Controller called "RecordTypeListCon" and is named as "RecordTypeList".  It declares two attributes as follow:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;sObjectType&lt;/span&gt;: values such as "Account", "Contact", generally the name of your object.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;value&lt;/span&gt;: you can capture the result of user's selection by using the attribute in your Vsualforce Controller.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;And here goes the code of the component's Controller:&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; RecordTypeListCon {&lt;br /&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; List&amp;lt;SelectOption&amp;gt; items;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;// property that reads the value from the Component attribute&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;string&lt;/span&gt; sObjectType&lt;br /&gt;{&lt;br /&gt;get;&lt;br /&gt;set;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;SelectOption&amp;gt; getItems() {&lt;br /&gt; List&amp;lt;SelectOption&amp;gt; items = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;SelectOption&amp;gt;();&lt;br /&gt;&lt;br /&gt; &lt;span class="rem"&gt;//default value&lt;/span&gt;&lt;br /&gt; items.add(&lt;span class="kwrd"&gt;new&lt;/span&gt; SelectOption(&lt;span class="str"&gt;''&lt;/span&gt;,&lt;span class="str"&gt;'--Select Record Type --'&lt;/span&gt;));&lt;br /&gt;&lt;br /&gt; &lt;span class="rem"&gt;//query force.com database to get the record type of the requested object.&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;for&lt;/span&gt;(RecordType rt: [select id,name from recordtype &lt;span class="kwrd"&gt;where&lt;/span&gt; sobjecttype=:sObjectType]) {&lt;br /&gt;      items.add(&lt;span class="kwrd"&gt;new&lt;/span&gt; SelectOption(rt.id,rt.name));&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; items;&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;Once you create this component in your Salesforce instance all you need to do when need to the selectList of your object's record types is to:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="ghjgjhg"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 50px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;c:RecordTypeList&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!lookupValue}"&lt;/span&gt; &lt;span class="attr"&gt;sObjectType&lt;/span&gt;&lt;span class="kwrd"&gt;="Account"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;c:RecordTypeList&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;Enjoy!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-4936402001803344892?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UHP6qUA2Rk4fJvFMK1Iqz-ZrqOY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UHP6qUA2Rk4fJvFMK1Iqz-ZrqOY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/UHP6qUA2Rk4fJvFMK1Iqz-ZrqOY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UHP6qUA2Rk4fJvFMK1Iqz-ZrqOY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/cWsuxwP_yHw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/4936402001803344892/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2009/01/visualforce-component-to-show-object.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/4936402001803344892?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/4936402001803344892?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/cWsuxwP_yHw/visualforce-component-to-show-object.html" title="Visualforce Component to show Object Record Types" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_A3gbIRtV9H8/SV5vf9kkJ5I/AAAAAAAAAII/drynhg2NuIk/s72-c/RecordTypesList.JPG" height="72" width="72" /><thr:total>9</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2009/01/visualforce-component-to-show-object.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEUBQ3w7fip7ImA9WxVTEEg.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-4497714839799871835</id><published>2008-12-23T11:40:00.005-05:00</published><updated>2008-12-23T13:17:32.206-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-12-23T13:17:32.206-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><category scheme="http://www.blogger.com/atom/ns#" term="Apex Code" /><title>URLFOR function finally explained!</title><content type="html">While developing your Visualforce pages you may need to be able to obtain the URL of certain actions, s-controls or your static resources.&lt;br /&gt;&lt;br /&gt;I found it personally a challenge since the documentation for "URLFOR" function is not included in "Visualforce Developer Guide" itself and instead included in the general help area of Salesforce.&lt;br /&gt;&lt;br /&gt;Generally you can use the "URLFOR" function for three purposes:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Obtain URL of a s-control&lt;/li&gt;&lt;li&gt;Obtain URL of a static resource&lt;/li&gt;&lt;li&gt;Obtain URL of an object's action&lt;/li&gt;&lt;/ol&gt;In this article I will demonstrate usages of the three above.&lt;br /&gt;&lt;br /&gt;Generally, URLFOR function &lt;span id="URLFORDef"&gt;returns a relative URL for an action, s-control, or a file in a static resource archive in a &lt;span&gt;Visualforce&lt;/span&gt; page.&lt;/span&gt; Following the syntax of the function:&lt;br /&gt;&lt;br /&gt;&lt;samp class="codeph"&gt;{!URLFOR(&lt;var class="varname"&gt;target&lt;/var&gt;, &lt;var class="varname"&gt;id&lt;/var&gt;, [&lt;var class="varname"&gt;inputs&lt;/var&gt;], [&lt;var class="varname"&gt;no override&lt;/var&gt;])}&lt;br /&gt;&lt;br /&gt;Parameters shown in brackets ([]) are optional.&lt;br /&gt;&lt;/samp&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;var class="varname"&gt;&lt;span style="font-weight: bold;"&gt;target&lt;/span&gt;: &lt;/var&gt;You can replace &lt;var class="varname"&gt;target&lt;/var&gt; with a URL or action, s-control or static resource.&lt;/li&gt;&lt;li&gt;&lt;var style="font-weight: bold;" class="varname"&gt;id&lt;/var&gt;:  This is id of the object or resource name (string type) in support of the provided target.&lt;/li&gt;&lt;li&gt;&lt;var class="varname"&gt;&lt;span style="font-weight: bold;"&gt;inputs&lt;/span&gt;:  &lt;/var&gt;Any additional URL parameters you need to pass you can use this parameter.&lt;br /&gt;you will to put the URL parameters in brackets and separate them with commas&lt;br /&gt;ex: [param1="value1", param2="value2"]&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;no override&lt;/span&gt;: A Boolean value which defaults to false, it applies to targets for standard Salesforce pages. Replace "no override" with "true" when you want to display a standard Salesforce page regardless of whether you have defined an override for it elsewhere.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Obtaining URL of a s-control:&lt;/span&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 100px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;&amp;lt;!-- Use $SControl global veriable to reference your s-control and pass it to the URLFOR function --&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!URLFOR($SControl.MySControlName)}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Link to my S-Control&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;span style="font-weight: bold;"&gt;Obtaining URL of a Static Resource&lt;/span&gt;&lt;br /&gt;&lt;b:includable id="StaticResource"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 200px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;&amp;lt;!-- Use $Resource global veriable to reference your resource file --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:image&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="{!URLFOR($Resource.LogoImg)}"&lt;/span&gt; &lt;span class="attr"&gt;width&lt;/span&gt;&lt;span class="kwrd"&gt;="50"&lt;/span&gt; &lt;span class="attr"&gt;height&lt;/span&gt;&lt;span class="kwrd"&gt;="50"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- If your file is in another ZIP file, then pass the path of the file as id to URLFOR --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:image&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="{!URLFOR($Resource.CorpZip, 'images/logo.gif')}"&lt;/span&gt; &lt;span class="attr"&gt;width&lt;/span&gt;&lt;span class="kwrd"&gt;="50"&lt;/span&gt; &lt;span class="attr"&gt;height&lt;/span&gt;&lt;span class="kwrd"&gt;="50"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Obtaining URLs of an Object's Actions:&lt;/span&gt;&lt;br /&gt;In order to get URL of the an object's actions you need to know what actions that object supports. Below are some of the common actions most Objects support:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;View&lt;/span&gt;: Shows the detail page of an object&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Edit&lt;/span&gt;: Shows the object in Edit mode&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Delete&lt;/span&gt;: URL for deleting an object&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;New&lt;/span&gt;: URL to create a new record of an object&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Tab&lt;/span&gt;: URL to the home page of an object&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;b:includable id="ObjectActions"&gt;However, each object may support additional actions for example &lt;span style="font-style: italic;"&gt;Contact &lt;/span&gt;also supports "Clone" action and &lt;span style="font-style: italic;"&gt;Case &lt;/span&gt;supports "CloseCase" action.&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- Use $Action global varialble to access the New action reference --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!URLFOR($Action.Account.New)}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;New&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- View action requires the id parameter, a standard controller can be used to obtain the id --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!URLFOR($Action.Account.view, account.id)}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;View&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- Edit action requires the id parameter, id is taken from standard controller in this example --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!URLFOR($Action.Account.Edit, account.id)}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Edit&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;  &lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- Delete action requires the id parameter, also a confirm message is added to prevent deleting the record when clicked by mistake --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!URLFOR($Action.Account.delete, account.id)}"&lt;/span&gt; &lt;span class="attr"&gt;onclick&lt;/span&gt;&lt;span class="kwrd"&gt;="return window.confirm('Are you sure?');"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Delete&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;br&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- From all custom buttons, links, s-controls and visualforce pages you can use the following to get the link of the object's homepage --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!URLFOR($Action.Account.Tab, $ObjectType.Account)}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-4497714839799871835?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/sLm54XxI4Ps36vv-ASSry-56zKo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sLm54XxI4Ps36vv-ASSry-56zKo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/sLm54XxI4Ps36vv-ASSry-56zKo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sLm54XxI4Ps36vv-ASSry-56zKo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/SA9WLNn2JPk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/4497714839799871835/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/12/urlfor-function-finally-explained.html#comment-form" title="10 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/4497714839799871835?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/4497714839799871835?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/SA9WLNn2JPk/urlfor-function-finally-explained.html" title="URLFOR function finally explained!" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>10</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/12/urlfor-function-finally-explained.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Dk8EQH09fyp7ImA9WxRaEEk.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-1624426916801874855</id><published>2008-12-04T11:20:00.011-05:00</published><updated>2008-12-11T20:20:01.367-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-12-11T20:20:01.367-05:00</app:edited><title>Modifying the Default Force.com Site Template to Build am Excellent Customer Portal</title><content type="html">Force.com Sites were released on December 2, 2008  (just two days ago) and we are all so excited about this new feature.&lt;br /&gt;&lt;br /&gt;Now you can potentially create Customer/Partner portals that are integrated with your CRM readily, this is big advantage plus that with ease of Visualforce's technology and shorter development life-cycles now you can deliver with a much faster pace.&lt;br /&gt;&lt;br /&gt;In this article I will demonstrate how fast we can modify our sites' template to customize the looked and feel our customer, partner, etc portals.&lt;br /&gt;&lt;br /&gt;With each new site that you create there are a few new Visualforce pages and components added to your box. some of those are:&lt;br /&gt;&lt;br /&gt;User Management Pages:&lt;ul&gt;&lt;li&gt;SiteLogin&lt;/li&gt;&lt;li&gt;SiteRegister&lt;/li&gt;&lt;li&gt;SiteRegisterConfirm&lt;/li&gt;&lt;li&gt;ForgotPassword&lt;/li&gt;&lt;li&gt;ForgotPasswordConfirm&lt;/li&gt;&lt;li&gt;Unauthorized&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Template:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;SiteTemplate&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;Components:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;SiteLogin&lt;/li&gt;&lt;li&gt;SiteHeader&lt;/li&gt;&lt;li&gt;SiteFooter&lt;/li&gt;&lt;/ul&gt;Also a few more pages for handling errors and such.&lt;br /&gt;&lt;br /&gt;Now let's take a closer look at the SiteTemplate:&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 300px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- showHeader is turned off so we won't see any Salesforce standard tabs or sidebar --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;showHeader&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="SiteTemplate"&lt;/span&gt; &lt;span class="attr"&gt;standardStylesheets&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- A section is reserved for header of the site --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:insert&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;c:SiteHeader&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;hr&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:insert&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- This section is where you can include the content of each page of your site--&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:insert&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="body"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- A section is reserved for footer of the site --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:insert&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="footer"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;hr&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;c:SiteFooter&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:insert&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;Generally it's a good practice that you follow the same pattern in developing your sites.&lt;br /&gt;&lt;br /&gt;Furthermore, it's best to include your logo, log in and out links, any headline that remains the same throughout your site and above all your site navigation menu to be included in the "SiteHeader" component.&lt;br /&gt;&lt;br /&gt;The same way, you can modify the "SiteFooter" component to add your site's pages footer template. It's good practice to include your site's shortcuts links and your company copy right message in this section.&lt;br /&gt;&lt;br /&gt;The shortcuts links in this section particularly is good for search engine purpose, in any case you may be using dynamic (javascript enabled) menus, so this part will compensate for that.&lt;br /&gt;&lt;br /&gt;Now let's see how we can benefits from all this. At this point you can start adding pages into your site. For your new pages to be able to utilize your template you need to do the following:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="sthelse"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 300px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;showHeader&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt; &lt;span class="attr"&gt;standardStylesheets&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:composition&lt;/span&gt; &lt;span class="attr"&gt;template&lt;/span&gt;&lt;span class="kwrd"&gt;="{!$Site.Template}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:define&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="body"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt;&amp;lt;!-- Page's Content go here --&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:define&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:composition&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;The above code, the Composite component enables the page to use our site template.&lt;br /&gt;&lt;br /&gt;Also if you need to overwrite the existing template's section (Insert Component), you will need to add a "apex:define" component with the same name attribute as the "insert" component in the template.&lt;br /&gt;&lt;br /&gt;So in order to overwrite the "body" section of the template, you will need write this line:&lt;br /&gt;&lt;br /&gt;&amp;lt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);"&gt;apex:define&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;name=&lt;/span&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;"body"&lt;/span&gt;&amp;gt;&lt;br /&gt;... You page's body...&lt;br /&gt;&amp;lt;&lt;span style="color: rgb(0, 0, 153); font-weight: bold;"&gt;apex:define&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;And one more thing, in order to be able to use your Static Resources in your force.com Sites, you are required to set the Cache mode of those resources to &lt;span style="font-weight: bold;"&gt;public&lt;/span&gt;. By default all them are in private mode.&lt;br /&gt;&lt;br /&gt;Click here to see a usage sample of such template in action:&lt;br /&gt;&lt;a href="http://zagrus-developer-edition.na5.force.com/Customer" target="_blank"&gt; http://zagrus-developer-edition.na5.force.com/Customer&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-1624426916801874855?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hvcQ-R4uuPI24YS37pTDUdO-3oI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hvcQ-R4uuPI24YS37pTDUdO-3oI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/hvcQ-R4uuPI24YS37pTDUdO-3oI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hvcQ-R4uuPI24YS37pTDUdO-3oI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/jKYgKO-ozHw" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/1624426916801874855/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/12/modifying-default-forcecom-site.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1624426916801874855?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1624426916801874855?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/jKYgKO-ozHw/modifying-default-forcecom-site.html" title="Modifying the Default Force.com Site Template to Build am Excellent Customer Portal" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>4</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/12/modifying-default-forcecom-site.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUICQHk4fCp7ImA9WxRbFE0.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-7216326913921009261</id><published>2008-11-12T11:46:00.005-05:00</published><updated>2008-12-04T11:19:21.734-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-12-04T11:19:21.734-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>Adding Sorting Capability to PageBlockTable Component</title><content type="html">In one of my previous posts I demonstrated how to add paging feature to your Visualforce Pages, in this article we will explore how we can add sorting option to the PageBlockTable component.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_A3gbIRtV9H8/SRsI665YflI/AAAAAAAAAHo/xmEOnlVF5Ro/s1600-h/sorting.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 320px;" src="http://1.bp.blogspot.com/_A3gbIRtV9H8/SRsI665YflI/AAAAAAAAAHo/xmEOnlVF5Ro/s400/sorting.JPG" alt="" id="BLOGGER_PHOTO_ID_5267813997475298898" border="0" /&gt;&lt;/a&gt;Challenges:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;How to replace standard header text with a link that calls a controller method for sorting the data&lt;/li&gt;&lt;li&gt;How to implement the link in such a way to support sort direction Ascending and Descending features&lt;/li&gt;&lt;li&gt;How to view Ascending and Descending state of the columns&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;And this is one way of meeting the above challenges:&lt;br /&gt;I first replace the standard header of the Column tag with a facet tag to include a commandLink component in it.&lt;br /&gt;&lt;br /&gt;Then I select the column name to be pasted as parameter to the controller once the commandLink header is clicked on.&lt;br /&gt;&lt;br /&gt;Then I add some condition to the Label of header to show "Ascending" and "Descending" icons.&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;controller&lt;/span&gt;&lt;span class="kwrd"&gt;="PageBlockTableSortingCon"&lt;/span&gt; &lt;span class="attr"&gt;tabStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="Account"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:sectionHeader&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Accounts List with Sorting"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:sectionHeader&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;=""&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="pageBlock"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockButtons&lt;/span&gt; &lt;span class="attr"&gt;location&lt;/span&gt;&lt;span class="kwrd"&gt;="top"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:commandButton&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="View"&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="{!ViewData}"&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="theButton"&lt;/span&gt; &lt;span class="attr"&gt;rerender&lt;/span&gt;&lt;span class="kwrd"&gt;="pageBlock"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:commandButton&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockButtons&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!accounts}"&lt;/span&gt; &lt;span class="attr"&gt;var&lt;/span&gt;&lt;span class="kwrd"&gt;="a"&lt;/span&gt; &lt;span class="attr"&gt;rendered&lt;/span&gt;&lt;span class="kwrd"&gt;="{!NOT(ISNULL(accounts))}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;   &lt;br /&gt;           &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:commandLink&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="{!ViewData}"&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="Account Name{!IF(sortExpression=='name',IF(sortDirection='ASC','▼','▲'),'')}"&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="cmdSort"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:param&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="name"&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="column"&lt;/span&gt; &lt;span class="attr"&gt;assignTo&lt;/span&gt;&lt;span class="kwrd"&gt;="{!sortExpression}"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:param&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:commandLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="/{!a.Id}"&lt;/span&gt; &lt;span class="attr"&gt;target&lt;/span&gt;&lt;span class="kwrd"&gt;="_blank"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;{!a.Name}&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:outputLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!a.Phone}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:commandLink&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="{!ViewData}"&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="Phone{!IF(sortExpression=='Phone',IF(sortDirection='ASC','▼','▲'),'')}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:param&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="Phone"&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="column"&lt;/span&gt; &lt;span class="attr"&gt;assignTo&lt;/span&gt;&lt;span class="kwrd"&gt;="{!sortExpression}"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:param&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:commandLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!a.BillingCity}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;          &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:commandLink&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="{!ViewData}"&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="Billing City{!IF(sortExpression=='BillingCity',IF(sortDirection='ASC','▼','▲'),'')}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:param&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="BillingCity"&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="column"&lt;/span&gt; &lt;span class="attr"&gt;assignTo&lt;/span&gt;&lt;span class="kwrd"&gt;="{!sortExpression}"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:param&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:commandLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!a.BillingCountry}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;          &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="header"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:commandLink&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="{!ViewData}"&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="Billing Country{!IF(sortExpression=='BillingCountry',IF(sortDirection='ASC','▼','▲'),'')}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;             &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:param&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="BillingCountry"&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="column"&lt;/span&gt; &lt;span class="attr"&gt;assignTo&lt;/span&gt;&lt;span class="kwrd"&gt;="{!sortExpression}"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:param&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;           &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:commandLink&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;         &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:facet&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;And this how the controller look like:&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; PageBlockTableSortingCon {&lt;br /&gt; &lt;br /&gt;   &lt;span class="kwrd"&gt;private&lt;/span&gt; List&amp;lt;Account&amp;gt; accounts;&lt;br /&gt;   &lt;span class="kwrd"&gt;private&lt;/span&gt; String sortDirection = &lt;span class="str"&gt;'ASC'&lt;/span&gt;;&lt;br /&gt;   &lt;span class="kwrd"&gt;private&lt;/span&gt; String sortExp = &lt;span class="str"&gt;'name'&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; String sortExpression&lt;br /&gt;   {&lt;br /&gt;     get&lt;br /&gt;     {&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; sortExp;&lt;br /&gt;     }&lt;br /&gt;     set&lt;br /&gt;     {&lt;br /&gt;       &lt;span class="rem"&gt;//if the column is clicked on then switch between Ascending and Descending modes&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;value&lt;/span&gt; == sortExp)&lt;br /&gt;         sortDirection = (sortDirection == &lt;span class="str"&gt;'ASC'&lt;/span&gt;)? &lt;span class="str"&gt;'DESC'&lt;/span&gt; : &lt;span class="str"&gt;'ASC'&lt;/span&gt;;&lt;br /&gt;       &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;         sortDirection = &lt;span class="str"&gt;'ASC'&lt;/span&gt;;&lt;br /&gt;       sortExp = &lt;span class="kwrd"&gt;value&lt;/span&gt;;&lt;br /&gt;     }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; String getSortDirection()&lt;br /&gt; {&lt;br /&gt;    &lt;span class="rem"&gt;//if not column is selected &lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (sortExpression == &lt;span class="kwrd"&gt;null&lt;/span&gt; || sortExpression == &lt;span class="str"&gt;''&lt;/span&gt;)&lt;br /&gt;      &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;'ASC'&lt;/span&gt;;&lt;br /&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; sortDirection;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; setSortDirection(String &lt;span class="kwrd"&gt;value&lt;/span&gt;)&lt;br /&gt; {  &lt;br /&gt;   sortDirection = &lt;span class="kwrd"&gt;value&lt;/span&gt;;&lt;br /&gt; }&lt;br /&gt;  &lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Account&amp;gt; getAccounts() {&lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; accounts;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;public&lt;/span&gt; PageReference ViewData() {&lt;br /&gt;       &lt;span class="rem"&gt;//build the full sort expression&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;string&lt;/span&gt; sortFullExp = sortExpression  + &lt;span class="str"&gt;' '&lt;/span&gt; + sortDirection;&lt;br /&gt;      &lt;br /&gt;       &lt;span class="rem"&gt;//query the database based on the sort expression&lt;/span&gt;&lt;br /&gt;       accounts = Database.query(&lt;span class="str"&gt;'Select id, Name, BillingCity, BillingCountry, Phone from Account order by '&lt;/span&gt; + sortFullExp + &lt;span class="str"&gt;' limit 1000'&lt;/span&gt;);&lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-7216326913921009261?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/bSBVrLxNgfLPoMX5vyausVcQTZM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bSBVrLxNgfLPoMX5vyausVcQTZM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/bSBVrLxNgfLPoMX5vyausVcQTZM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bSBVrLxNgfLPoMX5vyausVcQTZM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/yHWcbLKQeCo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/7216326913921009261/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/11/adding-sorting-capability-to.html#comment-form" title="11 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/7216326913921009261?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/7216326913921009261?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/yHWcbLKQeCo/adding-sorting-capability-to.html" title="Adding Sorting Capability to PageBlockTable Component" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_A3gbIRtV9H8/SRsI665YflI/AAAAAAAAAHo/xmEOnlVF5Ro/s72-c/sorting.JPG" height="72" width="72" /><thr:total>11</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/11/adding-sorting-capability-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEAFR30_eCp7ImA9WxRVEEo.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-6782478403187816451</id><published>2008-11-07T11:18:00.004-05:00</published><updated>2008-11-07T11:51:56.340-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-11-07T11:51:56.340-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Apex Code" /><title>A Utility Apex Class to Convert All Types Into String</title><content type="html">If you have been in the programming world long enough, you already know that casting types from one to another specially string representation of the variables is always part the job.&lt;br /&gt;&lt;br /&gt;Whether you want to show the data to user or form the variables in different formats, incorporate them in messages, etc.&lt;br /&gt;&lt;br /&gt;In this article I will present you one of the Apex classes I have written to help me faster develop Salesforce Applications.&lt;br /&gt;&lt;br /&gt;This class helps me in number of ways, for example I do not need to worry about the underlying Apex code to convert a primitive type to string anymore, for all types I just need to call one method "ToString" and it will take care of for me.&lt;br /&gt;Also the methods provide me with formatting capabilities, so I can not only convert to string but also format the string in many ways I need.&lt;br /&gt;&lt;br /&gt;Look at the below code and see how the results are:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 200px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;ApexPages.addmessage(&lt;span class="kwrd"&gt;new&lt;/span&gt; ApexPages.message(ApexPages.severity.INFO,&lt;span class="str"&gt;'Integer: '&lt;/span&gt;+ zConvert.ToString(13434)));&lt;br /&gt; ApexPages.addmessage(&lt;span class="kwrd"&gt;new&lt;/span&gt; ApexPages.message(ApexPages.severity.INFO,&lt;span class="str"&gt;'Double: '&lt;/span&gt;+ zConvert.ToString(1.23)));&lt;br /&gt; ApexPages.addmessage(&lt;span class="kwrd"&gt;new&lt;/span&gt; ApexPages.message(ApexPages.severity.INFO,&lt;span class="str"&gt;'Boolean: '&lt;/span&gt;+ zConvert.ToString(&lt;span class="kwrd"&gt;true&lt;/span&gt;)));&lt;br /&gt; ApexPages.addmessage(&lt;span class="kwrd"&gt;new&lt;/span&gt; ApexPages.message(ApexPages.severity.INFO,&lt;span class="str"&gt;'Date: '&lt;/span&gt; + zConvert.ToString(date.newinstance(1960, 2, 17))));&lt;br /&gt; ApexPages.addmessage(&lt;span class="kwrd"&gt;new&lt;/span&gt; ApexPages.message(ApexPages.severity.INFO,&lt;span class="str"&gt;'Date time: '&lt;/span&gt; + zConvert.ToString(Datetime.now(),&lt;span class="str"&gt;'MMM, dd yyyy'&lt;/span&gt;)));&lt;br /&gt; ApexPages.addmessage(&lt;span class="kwrd"&gt;new&lt;/span&gt; ApexPages.message(ApexPages.severity.INFO,&lt;span class="str"&gt;'File Size: '&lt;/span&gt;+ zConvert.FileSizeToString(6766767)));&lt;br /&gt; ApexPages.addmessage(&lt;span class="kwrd"&gt;new&lt;/span&gt; ApexPages.message(ApexPages.severity.INFO,&lt;span class="str"&gt;'Money: '&lt;/span&gt;+ zConvert.CurrencyToString(Decimal.valueOf(34.99),&lt;span class="str"&gt;'$'&lt;/span&gt;))&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;This is the result of running the above code:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_A3gbIRtV9H8/SRRtQO_WbmI/AAAAAAAAAHg/vGx5Ln-xXCQ/s1600-h/converter.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 167px;" src="http://1.bp.blogspot.com/_A3gbIRtV9H8/SRRtQO_WbmI/AAAAAAAAAHg/vGx5Ln-xXCQ/s400/converter.jpg" alt="" id="BLOGGER_PHOTO_ID_5265953989972094562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Well, very nice, now let's see how the actual class is developed:&lt;br /&gt;Because I would like to directly call my Coverter's class methods without creating a new instance of the class, I have defined all the methods as "static".&lt;br /&gt;&lt;br /&gt;The methods for this class are:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;ToString(Integer)&lt;/li&gt;&lt;li&gt;ToString(Double)&lt;/li&gt;&lt;li&gt;ToString(Long)&lt;/li&gt;&lt;li&gt;ToString(Boolean)&lt;/li&gt;&lt;li&gt;ToString(Date)&lt;/li&gt;&lt;li&gt;ToString(Date,format)&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;sample: zConvert.ToStrong(mydate,'MM-dd-yy')&lt;/span&gt;&lt;/li&gt;&lt;li&gt;ToString(Time)&lt;/li&gt;&lt;li&gt;ToString(Time,format)&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;sample: zConvert.ToStrong(myTime,'hh:mm:ss')&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;ToString(Datetime)&lt;/li&gt;&lt;li&gt;ToString(Datetime,format)&lt;/li&gt;&lt;li&gt;ToString(Decimal)&lt;/li&gt;&lt;li&gt;ToString(Decimal, ScientificNotaion)&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;ScientificNotaion is a Boolean value and if false is passed then the string will not have scientific notations.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;FileSizeToString(Long)&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;Returns values such as "5.5 KB", "8 MB", etc. Parameter passed is in bytes.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;CurrencyToString(Decimal, CurrencyChar)&lt;br /&gt;&lt;span style="color: rgb(102, 102, 102);"&gt;CurrencyChar can be "$", "£", etc&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; zConvert&lt;br /&gt;{&lt;br /&gt;&lt;span class="rem"&gt; /* The Initial Developer of the Original Code is Sam Arjmandi.&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt; * Portions created by the Initial Developer are Copyright (C) 2008&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt; * the Initial Developer. All Rights Reserved. &lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt; * &lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt; * This Code is provided "As Is" without warranty of any kind.&lt;/span&gt;&lt;br /&gt;&lt;span class="rem"&gt; */&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(integer Value)&lt;br /&gt;  {&lt;br /&gt;      &lt;span class="rem"&gt;/* string representation if an Integer value */&lt;/span&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;return&lt;/span&gt; Value.format();&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Double Value)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class="rem"&gt;/* string representation if a Double value */&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; Value.format();&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Boolean Value)&lt;br /&gt;  {&lt;br /&gt;     &lt;span class="rem"&gt;/* string representation if a Boolean value */&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;if&lt;/span&gt; (Value)&lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;'true'&lt;/span&gt;;&lt;br /&gt;     &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="str"&gt;'false'&lt;/span&gt;;&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Long Value)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class="rem"&gt;/* string representation if a Long value */&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; Value.format();&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Date Value)&lt;br /&gt;  {&lt;br /&gt;     &lt;span class="rem"&gt;/* string representation if a Date value */&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; Value.format();&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Date Value,String format)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class="rem"&gt;/* string representation if a Date value with formatting */&lt;/span&gt;&lt;br /&gt;    Datetime temp = Datetime.newInstance(Value.year(), Value.month(), Value.day());&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; temp.format(format);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Datetime Value)&lt;br /&gt;  {&lt;br /&gt;     &lt;span class="rem"&gt;/* string representation if a Datetime value */&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; Value.format();&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Datetime Value,String format)&lt;br /&gt;  {&lt;br /&gt;     &lt;span class="rem"&gt;/* string representation if a Datetime value with formatting */&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; Value.format(format);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Time Value)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class="rem"&gt;/* string representation if a Time value */&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; String.valueOf(Value);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Time Value, String format)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class="rem"&gt;/* string representation if a Time value with formating */&lt;/span&gt;&lt;br /&gt;    Datetime temp = Datetime.newInstance(1970, 1, 1, Value.hour(), Value.minute(), Value.second());&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; temp.format(format);&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Decimal Value)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class="rem"&gt;/* string representation if a Decimal value */&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; Value.format();&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String ToString(Decimal Value, Boolean ScientificNotation)&lt;br /&gt;  {&lt;br /&gt;    &lt;span class="rem"&gt;/* string representation if a Decimal value with or without Scientific Notation */&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (ScientificNotation)&lt;br /&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; Value.format();&lt;br /&gt;    &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; Value.toPlainString();&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String FileSizeToString(Long Value)&lt;br /&gt;  {&lt;br /&gt;     &lt;span class="rem"&gt;/* string representation if a file's size, such as 2 KB, 4.1 MB, etc */&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;if&lt;/span&gt; (Value &amp;lt; 1024)&lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; ToString(Value) + &lt;span class="str"&gt;' Bytes'&lt;/span&gt;;&lt;br /&gt;     &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;if&lt;/span&gt; (Value &amp;gt;= 1024 &amp;amp;&amp;amp; Value &amp;lt; (1024*1024))&lt;br /&gt;     {&lt;br /&gt;       &lt;span class="rem"&gt;//KB&lt;/span&gt;&lt;br /&gt;       Decimal kb = Decimal.valueOf(Value);&lt;br /&gt;       kb = kb.divide(1024,2);&lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; ToString(kb) + &lt;span class="str"&gt;' KB'&lt;/span&gt;;&lt;br /&gt;     }&lt;br /&gt;     &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;if&lt;/span&gt; (Value &amp;gt;= (1024*1024) &amp;amp;&amp;amp; Value &amp;lt; (1024*1024*1024))&lt;br /&gt;     {&lt;br /&gt;       &lt;span class="rem"&gt;//MB&lt;/span&gt;&lt;br /&gt;       Decimal mb = Decimal.valueOf(Value);&lt;br /&gt;       mb = mb.divide((1024*1024),2);&lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; ToString(mb) + &lt;span class="str"&gt;' MB'&lt;/span&gt;;&lt;br /&gt;     }&lt;br /&gt;     &lt;span class="kwrd"&gt;else&lt;/span&gt;&lt;br /&gt;     {&lt;br /&gt;       &lt;span class="rem"&gt;//GB&lt;/span&gt;&lt;br /&gt;       Decimal gb = Decimal.valueOf(Value);&lt;br /&gt;       gb = gb.divide((1024*1024*1024),2);&lt;br /&gt;      &lt;br /&gt;       &lt;span class="kwrd"&gt;return&lt;/span&gt; ToString(gb) + &lt;span class="str"&gt;' GB'&lt;/span&gt;;&lt;br /&gt;     }&lt;br /&gt;    &lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; String CurrencyToString(Decimal Value, String CurrencyChar)&lt;br /&gt;  {&lt;br /&gt;     &lt;span class="kwrd"&gt;return&lt;/span&gt; CurrencyChar + ToString(Value);&lt;br /&gt;  }&lt;br /&gt; &lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-6782478403187816451?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0Q_eukGS7pq05P25RWYeOz0c0kk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0Q_eukGS7pq05P25RWYeOz0c0kk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0Q_eukGS7pq05P25RWYeOz0c0kk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0Q_eukGS7pq05P25RWYeOz0c0kk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/TUtejP0Z9pU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/6782478403187816451/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/11/utility-apex-class-to-convert-all-types.html#comment-form" title="16 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/6782478403187816451?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/6782478403187816451?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/TUtejP0Z9pU/utility-apex-class-to-convert-all-types.html" title="A Utility Apex Class to Convert All Types Into String" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_A3gbIRtV9H8/SRRtQO_WbmI/AAAAAAAAAHg/vGx5Ln-xXCQ/s72-c/converter.jpg" height="72" width="72" /><thr:total>16</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/11/utility-apex-class-to-convert-all-types.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkAESXczcCp7ImA9WxRWEkQ.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-6824399062380169852</id><published>2008-10-28T11:30:00.008-04:00</published><updated>2008-10-29T10:31:48.988-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-29T10:31:48.988-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><category scheme="http://www.blogger.com/atom/ns#" term="Google Apps" /><title>How to Easily Bring Graphical Charts into your CRM?</title><content type="html">There is no doubt that nothing communicates better and faster than graphics with users. It has been always the case that users fail to utilize software solutions merely because the information is not delivered to them intuitively,  comprehensively and graphically.&lt;br /&gt;&lt;br /&gt;Managers often require summarized business critical information quick and easy to grasp. Utilizing charts in Web Applications has been a challenge for many of us over the past two decade and now it is all much easier than ever!&lt;br /&gt;&lt;br /&gt;Google Chart is an excellent tool available for free! It is actually very easy to work with and practical.&lt;br /&gt;&lt;br /&gt;In this article I will demonstrate how you can utilize this outstanding component to bring new life to your Salesforce pages!&lt;br /&gt;&lt;br /&gt;Example: I have a requirement to create a Visualforce page to view a pie chart that shows number of Accounts in our organization divided by their Types.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_A3gbIRtV9H8/SQczdDUcmeI/AAAAAAAAAHY/YzapNlGoDcc/s1600-h/googleCharts.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 207px;" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SQczdDUcmeI/AAAAAAAAAHY/YzapNlGoDcc/s400/googleCharts.jpg" alt="" id="BLOGGER_PHOTO_ID_5262231263806003682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Here is how it works:&lt;br /&gt;The Google Chart API requires me to pass the chart information via URL parameters and then in return Google will send me an image in PNG format. Then all I need to do is to view the image using the HTML img tag!&lt;br /&gt;&lt;br /&gt;Ingredients:&lt;br /&gt;Chart Server URL: http://chart.apis.google.com/chart&lt;br /&gt;Parameters List:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;chs: is in fact the chart size in pixels  ex: 300x200&lt;/li&gt;&lt;li&gt;chd: you will need to pass the chart data using this parameter. ex: t:60,40&lt;/li&gt;&lt;li&gt;cht: chart type, ex: p3&lt;/li&gt;&lt;li&gt;chl: chart items' label, ex: Data 1|Data 2&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;The above are all basic required parameters in order to create charts. So there is more to it if you are interested.&lt;br /&gt;&lt;br /&gt;So in order to utilize this component I create a Visualforce page as follows:&lt;br /&gt;&lt;b:includable id="pageCode"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 200px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;controller&lt;/span&gt;&lt;span class="kwrd"&gt;="googleChartCon"&lt;/span&gt; &lt;span class="attr"&gt;tabStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="Account"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:sectionHeader&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Accounts by Type"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:sectionHeader&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:image&lt;/span&gt; &lt;span class="attr"&gt;url&lt;/span&gt;&lt;span class="kwrd"&gt;="{!chartData}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:image&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;/b:includable&gt;&lt;br /&gt;This page only contains an apex:image component which talks to the controller to obtain it's image URL.&lt;br /&gt;&lt;br /&gt;The URL is where the magic happens so we will need to focus on that.&lt;br /&gt;&lt;br /&gt;In order to do this I first need to get a list of Account's "Type" picklist values and then&lt;br /&gt;in my custom controller, I create an internal Apex class to save the chart's data while I am running through Account's records and find out how many of which type we have in our database.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="controller"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;!--INFOLINKS_OFF--&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; googleChartCon {&lt;br /&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; String chartData;&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; String getChartData()inter&lt;br /&gt;{&lt;br /&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; chartData;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; googleChartCon()&lt;br /&gt;{&lt;br /&gt; &lt;span class="rem"&gt;//obtain a list of picklist values&lt;/span&gt;&lt;br /&gt; Schema.DescribeFieldResult F = Account.Type.getDescribe();&lt;br /&gt; List&amp;lt;Schema.PicklistEntry&amp;gt; P = F.getPicklistValues();&lt;br /&gt; &lt;span class="rem"&gt;//where chart data should be stored.&lt;/span&gt;&lt;br /&gt; List&amp;lt;ChartDataItem&amp;gt; items = &lt;span class="kwrd"&gt;new&lt;/span&gt; List&amp;lt;ChartDataItem&amp;gt;();&lt;br /&gt;&lt;br /&gt; &lt;span class="rem"&gt;//iterate through each picklist value and get number of accounts&lt;/span&gt;&lt;br /&gt; &lt;span class="rem"&gt;// I wish we could do GROUP BY in SOQL!&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;for&lt;/span&gt;(Schema.PicklistEntry pValue : P)&lt;br /&gt; {&lt;br /&gt;    integer Count = [select count() from Account &lt;span class="kwrd"&gt;where&lt;/span&gt; Type = :pValue.getValue() limit 10000];&lt;br /&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (Count &amp;gt; 0)&lt;br /&gt;      items.add(&lt;span class="kwrd"&gt;new&lt;/span&gt; ChartDataItem(pValue.getValue()+ &lt;span class="str"&gt;'-['&lt;/span&gt;+ Count.format() + &lt;span class="str"&gt;']'&lt;/span&gt; , Count.format()));&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; &lt;span class="rem"&gt;//Prepare the chart URL&lt;/span&gt;&lt;br /&gt; String chartPath = &lt;span class="str"&gt;'http://chart.apis.google.com/chart?chs=600x200&amp;amp;cht=p3'&lt;/span&gt;;&lt;br /&gt; chartData = chartPath +  getChartData(items);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;private&lt;/span&gt; String getChartData(List&amp;lt;ChartDataItem&amp;gt; items)&lt;br /&gt;{&lt;br /&gt; String chd = &lt;span class="str"&gt;''&lt;/span&gt;; &lt;span class="rem"&gt;//23,34,56&lt;/span&gt;&lt;br /&gt; String chl = &lt;span class="str"&gt;''&lt;/span&gt;; &lt;span class="rem"&gt;//Hello|World&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;for&lt;/span&gt;(ChartDataItem citem : items)&lt;br /&gt; {&lt;br /&gt;    chd += citem.ItemValue + &lt;span class="str"&gt;','&lt;/span&gt;;&lt;br /&gt;    chl += citem.Label + &lt;span class="str"&gt;'|'&lt;/span&gt;;&lt;br /&gt; }&lt;br /&gt; &lt;span class="rem"&gt;//remove the last comma or pipe&lt;/span&gt;&lt;br /&gt; chd = chd.substring(0, chd.length() -1);&lt;br /&gt; chl = chl.substring(0, chl.length() -1);&lt;br /&gt;&lt;br /&gt; String result = &lt;span class="str"&gt;'&amp;amp;chd=t:'&lt;/span&gt; + chd + &lt;span class="str"&gt;'&amp;amp;chl='&lt;/span&gt; + chl;&lt;br /&gt; &lt;span class="kwrd"&gt;return&lt;/span&gt; result;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ChartDataItem&lt;br /&gt;{&lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; String ItemValue&lt;br /&gt; {&lt;br /&gt;  get;&lt;br /&gt;  set;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; String Label&lt;br /&gt; {&lt;br /&gt;   get;&lt;br /&gt;   set;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; ChartDataItem(String Label, String Value)&lt;br /&gt; {&lt;br /&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.Label = Label;&lt;br /&gt;    &lt;span class="kwrd"&gt;this&lt;/span&gt;.ItemValue = Value;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;!--INFOLINKS_ON--&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;For some security might be a concern sending the data via URL parameters. &lt;br /&gt;Up to this point, I have not been able to confirm if Google is officially supporting SSL connections to rectify this problem. However the following seems to be fine:&lt;br /&gt;&lt;br /&gt; &lt;a href="https://www.google.com/chart?cht=p3&amp;chd=t:60,40&amp;chs=250x100&amp;chl=Hello|World" target="_blank"&gt;&lt;span style="text-decoration: underline;"&gt;https://www.google.com/chart?cht=p3&amp;chd=t:60,40&amp;chs=250x100&amp;chl=Hello|World&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In this article I have barely scratched the surface of Google Charts API, if you are interested to learn more about it go to &lt;a href="http://code.google.com/apis/chart/"&gt;http://code.google.com/apis/chart/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-6824399062380169852?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/umtvwzpSt4kMS3PGVUb_fdBfZdE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/umtvwzpSt4kMS3PGVUb_fdBfZdE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/umtvwzpSt4kMS3PGVUb_fdBfZdE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/umtvwzpSt4kMS3PGVUb_fdBfZdE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/ZdeNKFb9kdI" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/6824399062380169852/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/10/how-to-easily-bring-graphical-charts.html#comment-form" title="8 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/6824399062380169852?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/6824399062380169852?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/ZdeNKFb9kdI/how-to-easily-bring-graphical-charts.html" title="How to Easily Bring Graphical Charts into your CRM?" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_A3gbIRtV9H8/SQczdDUcmeI/AAAAAAAAAHY/YzapNlGoDcc/s72-c/googleCharts.jpg" height="72" width="72" /><thr:total>8</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/10/how-to-easily-bring-graphical-charts.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ck8CQHg-eip7ImA9WxRWEkw.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-1030495940504665710</id><published>2008-10-23T20:50:00.007-04:00</published><updated>2008-10-28T12:21:01.652-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-28T12:21:01.652-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>Working With Multiselect Picklists</title><content type="html">Working with Picklists essentially is rewarded since it limits the options of the user and standards what is valid as a value for a field in the system. As good as they are however they bring their own complexity with them.&lt;br /&gt;&lt;br /&gt;This is especially true when you are working with multi-select Picklists. Mostly Visualforce’s inputField is used to view multi-select Picklists as Salesforce team is working on it to be more effective and error-free.&lt;br /&gt;&lt;br /&gt;In this article we will see how to use the multi-select Picklists.&lt;br /&gt;&lt;br /&gt;First off, let’s see how we can load values into our Picklist and view it on our Visualforce page.&lt;br /&gt;Let’s say I have a custom multi-select Picklist field on my User object to define sales regions my users operate on.&lt;br /&gt;&lt;br /&gt;The picklist has values such as:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;North America&lt;/li&gt;&lt;li&gt;Latin America&lt;/li&gt;&lt;li&gt;Europe&lt;/li&gt;&lt;li&gt;Asia&lt;/li&gt;&lt;li&gt;Middle East&lt;/li&gt;&lt;li&gt;Africa&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;and so on&lt;br /&gt;&lt;br /&gt;In my controller class I add the following property:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="somecon"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 300px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; multiselectPicklist {&lt;br /&gt; &lt;span class="kwrd"&gt;private&lt;/span&gt; User salesRegions;&lt;br /&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; multiselectPicklist()&lt;br /&gt; {&lt;br /&gt;    salesRegions = &lt;span class="kwrd"&gt;new&lt;/span&gt; User();&lt;br /&gt; }&lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; User getSalesRegions() {&lt;br /&gt;      &lt;span class="kwrd"&gt;return&lt;/span&gt; salesRegions;&lt;br /&gt; }&lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; setSalesRegions(User Value) {&lt;br /&gt;      salesRegions = Value;&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;As you can see it is enough to create a new User object and later on use the picklist field to show the values on your page. Unfortunately there is no other way through which you would more control over what values are shown on your multi-select control. May be in future Salesforce will supply a Component for multi-select operations.&lt;br /&gt;&lt;br /&gt;Please note that I have created a setter property as well that receives a User object. This setter allows us to later on read the selected values by user.&lt;br /&gt;&lt;br /&gt;Now that we have our controller ready we can program our page to view our multi-select picklist.&lt;br /&gt;in this example what I am trying to achieve is that to allow the user choose as many regions as he/she wants and them filter the Users of the system and view only those who are assigned to those regions.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;controller&lt;/span&gt;&lt;span class="kwrd"&gt;="multiselectPicklist"&lt;/span&gt; &lt;span class="attr"&gt;tabStyle&lt;/span&gt;&lt;span class="kwrd"&gt;="User"&lt;/span&gt; &lt;span class="attr"&gt;sideBar&lt;/span&gt;&lt;span class="kwrd"&gt;="false"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:sectionHeader&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Users by Region Report"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:sectionHeader&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="pageBlock"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Search Filter"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockSection&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Filters"&lt;/span&gt; &lt;span class="attr"&gt;columns&lt;/span&gt;&lt;span class="kwrd"&gt;="2"&lt;/span&gt; &lt;span class="attr"&gt;collapsible&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="salesRegions"&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!salesRegions.Sales_Regions__c}"&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:inputField&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockSection&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="searchResults"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Results"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockButtons&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:commandButton&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="Run Report"&lt;/span&gt; &lt;span class="attr"&gt;action&lt;/span&gt;&lt;span class="kwrd"&gt;="{!runReport}"&lt;/span&gt; &lt;span class="attr"&gt;status&lt;/span&gt;&lt;span class="kwrd"&gt;="status"&lt;/span&gt; &lt;span class="attr"&gt;rerender&lt;/span&gt;&lt;span class="kwrd"&gt;="searchResults"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:commandButton&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockButtons&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!users}"&lt;/span&gt; &lt;span class="attr"&gt;var&lt;/span&gt;&lt;span class="kwrd"&gt;="u"&lt;/span&gt; &lt;span class="attr"&gt;rendered&lt;/span&gt;&lt;span class="kwrd"&gt;="{!NOT(ISNULL(users))}"&lt;/span&gt; &lt;span class="attr"&gt;rules&lt;/span&gt;&lt;span class="kwrd"&gt;="cols"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!u.UserName}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!u.IsActive}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;     &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlock&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:Page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;Something that you should bear in mind is that even though multi-select option suggests that you should be dealing with a list of Strings as a result of user’s interaction with your control on the page all you will receive will just a semicolon separated string. It is your job to separate the values and use then in whatever endeavor you intend to have.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_A3gbIRtV9H8/SQIsw3ZwejI/AAAAAAAAAG4/B8fc8-p3WNU/s1600-h/multiselectpicklist.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 220px;" src="http://4.bp.blogspot.com/_A3gbIRtV9H8/SQIsw3ZwejI/AAAAAAAAAG4/B8fc8-p3WNU/s400/multiselectpicklist.jpg" alt="" id="BLOGGER_PHOTO_ID_5260816532739488306" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Below on my button action I have demonstrated how you can read the selected values back and use them in your query to get a list of users in those sales regions:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="controller"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 440px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; PageReference runReport() {&lt;br /&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (salesRegions.Sales_Regions__c == &lt;span class="kwrd"&gt;null&lt;/span&gt; || salesRegions.Sales_Regions__c == &lt;span class="str"&gt;''&lt;/span&gt;) {&lt;br /&gt;      apexPages.addmessage(&lt;span class="kwrd"&gt;new&lt;/span&gt; ApexPages.message(ApexPages.severity.INFO, &lt;span class="str"&gt;'Please select one or more regions first.'&lt;/span&gt;));&lt;br /&gt;      &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="rem"&gt;// read the values into an array&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;string&lt;/span&gt;[] regions = salesRegions.Sales_Regions__c.split(&lt;span class="str"&gt;';'&lt;/span&gt;,0);&lt;br /&gt;    &lt;span class="kwrd"&gt;if&lt;/span&gt; (regions != &lt;span class="kwrd"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; regions.size() &amp;gt; 0)&lt;br /&gt;    {&lt;br /&gt;       &lt;span class="rem"&gt;//query the database based on the user's selection&lt;/span&gt;&lt;br /&gt;       users = [select Username, IsActive, Id from user &lt;span class="kwrd"&gt;where&lt;/span&gt; Sales_Regions__c &lt;span class="kwrd"&gt;in&lt;/span&gt; :regions and IsActive = &lt;span class="kwrd"&gt;true&lt;/span&gt; order by Username];&lt;br /&gt;    }&lt;br /&gt;  &lt;br /&gt;      &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;private&lt;/span&gt; List&amp;lt;User&amp;gt; users;&lt;br /&gt; &lt;br /&gt; &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;User&amp;gt; getUsers()&lt;br /&gt; {&lt;br /&gt;    &lt;span class="kwrd"&gt;return&lt;/span&gt; users;&lt;br /&gt; }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Something funny that occurred to me was that I tried to hook the Multi-select Component (inputField) with actionSupport to capture onChange event and load values of another Picklist item on my project which was totally a disappointment! It seems that the Salesforce team has been able to get that one to work yet.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-1030495940504665710?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/negYtp7qx1eZbSA99OBhBZYzO1k/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/negYtp7qx1eZbSA99OBhBZYzO1k/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/negYtp7qx1eZbSA99OBhBZYzO1k/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/negYtp7qx1eZbSA99OBhBZYzO1k/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/F7mDDgdozVo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/1030495940504665710/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/10/working-with-multiselect-picklists.html#comment-form" title="11 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1030495940504665710?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/1030495940504665710?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/F7mDDgdozVo/working-with-multiselect-picklists.html" title="Working With Multiselect Picklists" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_A3gbIRtV9H8/SQIsw3ZwejI/AAAAAAAAAG4/B8fc8-p3WNU/s72-c/multiselectpicklist.jpg" height="72" width="72" /><thr:total>11</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/10/working-with-multiselect-picklists.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0EBQXs5eip7ImA9WxRXGEo.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-6997886209679775542</id><published>2008-10-22T21:43:00.008-04:00</published><updated>2008-10-24T14:07:30.522-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-24T14:07:30.522-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>How to Create Custom Related-List on Visualforce Pages</title><content type="html">In the past few weeks in many cases I came across the requirement to add a custom list to the Object's detail page.&lt;br /&gt;&lt;br /&gt;The list should be just like related-lists such as "Open Activities" or "Google Docs, Notes, &amp;amp; Attachments", however it is suppose to view a list of data which is somehow relevant to the object but not necessarily from an object directly related to the current object's page.&lt;br /&gt;&lt;br /&gt;Let's consider this example, imagine we need to view a list of opportunities related to a Contact through it's Account relationship (not the ones that are directly linked to the Contact).&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://1.bp.blogspot.com/_A3gbIRtV9H8/SP_YfhsZuOI/AAAAAAAAAGg/cuutcCy0B_A/s1600-h/detailPage_relatedlist.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260160925924178146" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 115px; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_A3gbIRtV9H8/SP_YfhsZuOI/AAAAAAAAAGg/cuutcCy0B_A/s400/detailPage_relatedlist.gif" border="0" /&gt;&lt;/a&gt; This is to say that if Contact A is linked to Account X and Account X has 5 opportunities linked to it, by viewing Contact A's details we would be able to view those opportunities as well.&lt;br /&gt;&lt;br /&gt;Ok, now action, in order to do this we will need to create a new Visualforce Page and Controller extension.&lt;br /&gt;&lt;br /&gt;So I add this text in front of http://yourOrg.salesforce.com/apex/SampleDetailPage and create the new page instantly (This is only possible when you profile is set to work in developer mode).&lt;/p&gt;&lt;br /&gt;&lt;p&gt;I set the page's Controller attribute to "Contact" and call my extension "SampleDetailPageCon".&lt;br /&gt;On the page all I need to do is to show the existing Contact details based on whatever active layout target user has chosen and then add my related-list to the bottom of the page. The page code goes like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="OVERFLOW: auto; WIDTH: 98%; HEIGHT: 400px; BACKGROUND-COLOR: rgb(245,245,240)"&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt; &lt;span class="attr"&gt;standardController&lt;/span&gt;&lt;span class="kwrd"&gt;="Contact"&lt;/span&gt; &lt;span class="attr"&gt;extensions&lt;/span&gt;&lt;span class="kwrd"&gt;="sampleDetailPageCon"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;.fewerMore { display: none;}&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;style&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageMessages&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:detail&lt;/span&gt; &lt;span class="attr"&gt;relatedList&lt;/span&gt;&lt;span class="kwrd"&gt;="true"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:detail&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageblock&lt;/span&gt; &lt;span class="attr"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;="CustomList"&lt;/span&gt; &lt;span class="attr"&gt;title&lt;/span&gt;&lt;span class="kwrd"&gt;="Related Opportunities"&lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!oppz}"&lt;/span&gt; &lt;span class="attr"&gt;var&lt;/span&gt;&lt;span class="kwrd"&gt;="o"&lt;/span&gt; &lt;span class="attr"&gt;rendered&lt;/span&gt;&lt;span class="kwrd"&gt;="{!NOT(ISNULL(oppz))}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!o.Name}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!o.Account.Name}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!o.Type}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!o.Amount}"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:column&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="{!o.CloseDate}"&lt;/span&gt;&lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageBlockTable&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;   &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;apex:outputLabel&lt;/span&gt; &lt;span class="attr"&gt;value&lt;/span&gt;&lt;span class="kwrd"&gt;="No records to display"&lt;/span&gt; &lt;span class="attr"&gt;rendered&lt;/span&gt;&lt;span class="kwrd"&gt;="{!(ISNULL(oppz))}"&lt;/span&gt; &lt;span class="attr"&gt;styleClass&lt;/span&gt;&lt;span class="kwrd"&gt;="noRowsHeader"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:outputLabel&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:pageblock&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:form&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;apex:page&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;A few tips, normally at the end of detail page Salesforce publishes a component for viewing a few more or a few less records to adjust the size of the page.&lt;br /&gt;&lt;br /&gt;Since our related list will be rendered under this component it might not be a bad idea to get rid of it. If you pay attention to be page's code you will see that a style tag has been added to the page that will just do that.&lt;br /&gt;&lt;br /&gt;Apart from this everything else is very straight forward. Now all we need to do is to extend the Contact's standard controller and make it able to generate a list of related Opportunities as well.&lt;br /&gt;&lt;br /&gt;Here is the Controller's Code:&lt;br /&gt;&lt;?xml:namespace prefix = b /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="OVERFLOW: auto; WIDTH: 98%; HEIGHT: 400px; BACKGROUND-COLOR: rgb(245,245,240)"&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; sampleDetailPageCon {&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; List&amp;lt;Opportunity&amp;gt; oppz;&lt;br /&gt;    &lt;span class="kwrd"&gt;private&lt;/span&gt; Contact cntact; &lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; sampleDetailPageCon(ApexPages.StandardController controller) {&lt;br /&gt;        &lt;span class="kwrd"&gt;this&lt;/span&gt;.cntact= (Contact)controller.getRecord();&lt;br /&gt;    }&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; List&amp;lt;Opportunity&amp;gt; getOppz()&lt;br /&gt;    {&lt;br /&gt;        Contact con = [Select id, Account.id FROM Contact &lt;span class="kwrd"&gt;where&lt;/span&gt; id = :cntact.id];&lt;br /&gt;        &lt;span class="kwrd"&gt;if&lt;/span&gt; (con.Account == &lt;span class="kwrd"&gt;null&lt;/span&gt;)&lt;br /&gt;         &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;null&lt;/span&gt;;&lt;br /&gt;        oppz = [Select id, Name, Account.Name, CloseDate, Amount, Type from Opportunity &lt;span class="kwrd"&gt;where&lt;/span&gt; Account.id = :con.Account.id];&lt;br /&gt;        &lt;span class="kwrd"&gt;return&lt;/span&gt; oppz;&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;br /&gt;As you can see this also very simple. In the above code, I have just added a method called "getOppz()" in which I first try to see if the Contact is linked to any accounts and if yes then use the Account id to get a list of its Opportunities.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That's it! Now if you need your page to be used by Salesforce as default detail page all you need to do is:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Go to: Setup -&gt; Customize -&gt; Contacts -&gt; Buttons and Links&lt;/li&gt;&lt;li&gt;Click on "override" next to "View" label&lt;/li&gt;&lt;li&gt;Select "Visualforce Page" and then your page from the drop down list&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;p&gt;Now there is only one thing left, as you all have noticed every related-list has a hover feature on the top of the page where user can quickly view all the related-lists without scrolling down the whole page.&lt;br /&gt;&lt;br /&gt;&lt;a href="http://3.bp.blogspot.com/_A3gbIRtV9H8/SP_l4HpJinI/AAAAAAAAAGw/ymIqRkvGSTU/s1600-h/detailPage_relatedlist2.gif"&gt;&lt;img id="BLOGGER_PHOTO_ID_5260175642079103602" style="DISPLAY: block; MARGIN: 0px auto 10px; WIDTH: 400px; CURSOR: hand; HEIGHT: 141px; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_A3gbIRtV9H8/SP_l4HpJinI/AAAAAAAAAGw/ymIqRkvGSTU/s400/detailPage_relatedlist2.gif" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;In my next article I will show you how you can go through the backdoor to add your related-list on the top of the page! &lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-6997886209679775542?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/F0fkH7IJIGeXkxCe8idrmG_Hn78/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/F0fkH7IJIGeXkxCe8idrmG_Hn78/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/F0fkH7IJIGeXkxCe8idrmG_Hn78/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/F0fkH7IJIGeXkxCe8idrmG_Hn78/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/HbYafdzvkfo" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/6997886209679775542/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/10/how-to-create-custom-related-list-on.html#comment-form" title="25 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/6997886209679775542?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/6997886209679775542?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/HbYafdzvkfo/how-to-create-custom-related-list-on.html" title="How to Create Custom Related-List on Visualforce Pages" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_A3gbIRtV9H8/SP_YfhsZuOI/AAAAAAAAAGg/cuutcCy0B_A/s72-c/detailPage_relatedlist.gif" height="72" width="72" /><thr:total>25</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/10/how-to-create-custom-related-list-on.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYNR3s8fCp7ImA9WxRXE0s.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-240288305319647826</id><published>2008-10-10T14:46:00.009-04:00</published><updated>2008-10-18T16:36:36.574-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-18T16:36:36.574-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><category scheme="http://www.blogger.com/atom/ns#" term="Google Apps" /><title>Bringing Google Calendar into Salesforce CRM pages</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_A3gbIRtV9H8/SO-qB3KRv2I/AAAAAAAAAGY/FfQRgMemLy4/s1600-h/googlecal_salesforce.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5255606239128305506" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SO-qB3KRv2I/AAAAAAAAAGY/FfQRgMemLy4/s400/googlecal_salesforce.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Since the very first time I saw Google Calendar' API, I wondered if it can be used for any bizarre or genius applications (having a sense of a-tool-for-public) or not. For example I really liked to be able to load Google Calendar into my page and then using the API add as many events as I desire on it from my own database without any authentication requirement and just for the sake of showing the data to user, but I have not been able to get it work in that order so far.&lt;br /&gt;&lt;br /&gt;Yet there are a lot of other benefits that Google Calendar can bring along, in terms of sharing events, publishing, flexibility and integration with other portals/applications in the cloud.&lt;br /&gt;&lt;br /&gt;One of things you might find useful is the capability of sharing a Google public calendar with your Salesforce CRM users.&lt;br /&gt;&lt;br /&gt;At first I tried to publish my own personal calendar into Salesforce, and I was successful to some extent. I could see the calendar is being shown properly and I can switch between the weekly, monthly, etc views. All nice, but I noticed that the Calendar is empty and my events are missing.&lt;br /&gt;&lt;br /&gt;In Google Calendar's documentation is not mentioned that you should use a public calendar to be able to share it in other websites or maybe that goes without saying! So I initially thought that any Calendar could be shared and as long as my event is set as public people should be able to see them.&lt;br /&gt;&lt;br /&gt;It was more like one of those scenarios where you show a button on your page to a user but say "Do not click on it, ok my boy?"&lt;br /&gt;&lt;br /&gt;Anyway, in order to publish the calendar on your Salesforce CRM, you should first think about where you want to place it and you may require to create a new Visualforce page before copying the calendar HTML code into it.&lt;br /&gt;&lt;br /&gt;In order to get the calendar's HTML code go to your Google Calendar page and either create a new Calendar to publish it as public calendar or if you already have one then click on settings (on the left side of the screen).&lt;br /&gt;&lt;br /&gt;Once you have your public calendar ready go to its "details" page and look for a spot that says "Embed This Calendar", copy the code and paste it into your Visualforce page. That's all!&lt;br /&gt;&lt;br /&gt;&lt;?xml:namespace prefix = b /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="OVERFLOW: auto; WIDTH: 98%; HEIGHT: 200px; BACKGROUND-COLOR: rgb(245,245,240)"&gt;&lt;br /&gt;&amp;lt;apex:page tabStyle="Campaign"&amp;gt;&lt;br /&gt;&amp;lt;apex:form &amp;gt;&lt;br /&gt;&amp;lt;/apex:form&amp;gt;&lt;br /&gt;&amp;lt;iframe src="http://www.google.com/calendar/embed?src=6lectl1l76jrmul8st527rbq6c%40group.calendar.google.com&amp;amp;ctz=America/New_York&amp;amp;color=%23336699;" style="border: 0" width="800" height="600" frameborder="0" scrolling="no"&amp;gt;&amp;lt;/iframe&amp;gt;&lt;br /&gt;&amp;lt;/apex:page&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;And you will see something like below in your page:&lt;br /&gt;&lt;br /&gt;&lt;iframe style="BORDER-RIGHT: 0pt; BORDER-TOP: 0pt; BORDER-LEFT: 0pt; BORDER-BOTTOM: 0pt" src="http://www.google.com/calendar/embed?src=6lectl1l76jrmul8st527rbq6c%40group.calendar.google.com&amp;amp;ctz=America/New_York&amp;amp;color=%23336699;" frameborder="0" width="400" scrolling="no" height="600"&gt;&lt;/iframe&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-240288305319647826?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/bqWSx3BACvn5TEK9m-no4jHfxGA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bqWSx3BACvn5TEK9m-no4jHfxGA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/bqWSx3BACvn5TEK9m-no4jHfxGA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/bqWSx3BACvn5TEK9m-no4jHfxGA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/swCFFTow0ds" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/240288305319647826/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/10/bringing-google-calendar-into.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/240288305319647826?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/240288305319647826?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/swCFFTow0ds/bringing-google-calendar-into.html" title="Bringing Google Calendar into Salesforce CRM pages" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_A3gbIRtV9H8/SO-qB3KRv2I/AAAAAAAAAGY/FfQRgMemLy4/s72-c/googlecal_salesforce.jpg" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/10/bringing-google-calendar-into.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4MQ3wyeCp7ImA9WxRQFkk.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-6014840908385137125</id><published>2008-10-09T14:47:00.009-04:00</published><updated>2008-10-10T10:29:42.290-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-10T10:29:42.290-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>Utilizing Dynamic Apex Feature in Winter 09 Release!</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_A3gbIRtV9H8/SO5ubAXyQTI/AAAAAAAAAGQ/fgtAmbUUIs8/s1600-h/searchPage.jpg"&gt;&lt;img id="BLOGGER_PHOTO_ID_5255259225423233330" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: pointer; TEXT-ALIGN: center" alt="" src="http://3.bp.blogspot.com/_A3gbIRtV9H8/SO5ubAXyQTI/AAAAAAAAAGQ/fgtAmbUUIs8/s400/searchPage.jpg" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Well for some of us yet the developer edition is not supporting the all glorious Salesforce CRM winter 09 features such as Dynamic Apex.&lt;br /&gt;&lt;br /&gt;However, those who have been able to get their hands on it already know that this release has opened up a lot of new possibilities for developing Visualforce pages. Even though here and there I still stumble over some glitches or nice-to-haves, I have decided to devote some of my time each day to learning the new stuff and incorporate them into my apps.&lt;br /&gt;&lt;br /&gt;In this article we will see how we can build Dynamic SOQL queries, execute them, get exactly the records we want and moreover we will see how we can now easier than ever hook our selectLists to object's picklists.&lt;br /&gt;&lt;br /&gt;For this example, consider filtering Account records based on Name, Type, Ownership and also we want the user to choose how many records they want to get back on the screen.&lt;br /&gt;&lt;br /&gt;Points:&lt;br /&gt;I have used a PanelGrid to put my filter Components in and PageBlockTable to view the results.&lt;br /&gt;The page is pretty standrad, what Winter 09 features are about in this article are all in the Controller's Code.&lt;br /&gt;&lt;br /&gt;&lt;?xml:namespace prefix = b /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;b:includable id="something"&gt;&lt;div style="OVERFLOW: auto; WIDTH: 98%; HEIGHT: 400px; BACKGROUND-COLOR: rgb(245,245,240)"&gt;&lt;br /&gt;&amp;lt;apex:page controller="myPageController" tabStyle="Account"&amp;gt;&lt;br /&gt;&amp;lt;apex:form &amp;gt;&lt;br /&gt;&amp;lt;apex:sectionHeader title="Customer Search" /&amp;gt;&lt;br /&gt;&amp;lt;apex:PanelGrid columns="2" id="panel" cellpadding="2"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;apex:outputLabel value="Account Name: "&amp;gt;&amp;lt;/apex:outputLabel&amp;gt;&lt;br /&gt;&amp;lt;apex:inputText id="textbox" value="{!searchText}" size="40" style="height:13px;font-size:11px;"&amp;gt;&amp;lt;/apex:inputText&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;apex:outputLabel value="Type: "&amp;gt;&amp;lt;/apex:outputLabel&amp;gt;&lt;br /&gt;&amp;lt;apex:selectList size="1" id="accountType" value="{!accountType}"&amp;gt;&lt;br /&gt;&amp;lt;apex:selectOptions value="{!accountTypes}"&amp;gt;&amp;lt;/apex:selectOptions&amp;gt;&lt;br /&gt;&amp;lt;/apex:selectList&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;apex:outputLabel value="Ownership:"&amp;gt;&amp;lt;/apex:outputLabel&amp;gt;&lt;br /&gt;&amp;lt;apex:selectList size="1" id="accountOwnership" value="{!accountOwnership}"&amp;gt;&lt;br /&gt;&amp;lt;apex:selectOptions value="{!accountOwnerships}"&amp;gt;&amp;lt;/apex:selectOptions&amp;gt;&lt;br /&gt;&amp;lt;/apex:selectList&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;apex:outputLabel value="Result:"&amp;gt;&amp;lt;/apex:outputLabel&amp;gt;&lt;br /&gt;&amp;lt;apex:selectList size="1" id="resultNo" value="{!resultNo}"&amp;gt;&lt;br /&gt;&amp;lt;apex:selectOption itemValue="50" itemLabel="50"&amp;gt;&amp;lt;/apex:selectOption&amp;gt;&lt;br /&gt;&amp;lt;apex:selectOption itemValue="100" itemLabel="100"&amp;gt;&amp;lt;/apex:selectOption&amp;gt;&lt;br /&gt;&amp;lt;apex:selectOption itemValue="150" itemLabel="150"&amp;gt;&amp;lt;/apex:selectOption&amp;gt;&lt;br /&gt;&amp;lt;/apex:selectList&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;apex:commandButton action="{!search}" value="Search" rerender="pageblock"&amp;gt;&amp;lt;/apex:commandButton&amp;gt;&lt;br /&gt;&amp;lt;/apex:PanelGrid&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/apex:form&amp;gt;&lt;br /&gt;&amp;lt;br/&amp;gt;&lt;br /&gt;&amp;lt;apex:pageblock id="pageblock" &amp;gt;&lt;br /&gt;&amp;lt;apex:messages&amp;gt;&amp;lt;/apex:messages&amp;gt;&lt;br /&gt;&amp;lt;apex:pageBlockSection title="Results" id="results" columns="1" collapsible="true"&amp;gt;&lt;br /&gt;&amp;lt;apex:pageBlockTable value="{!accountResults}" var="a" rendered="{!NOT(ISNULL(accountResults))}"&amp;gt;&lt;br /&gt;&amp;lt;apex:column value="{!a.Name}"&amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;&amp;lt;apex:column value="{!a.Type}"&amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;&amp;lt;apex:column value="{!a.Ownership}"&amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;&amp;lt;apex:column value="{!a.Industry}"&amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;&amp;lt;/apex:pageBlockTable&amp;gt;&lt;br /&gt;&amp;lt;/apex:pageBlockSection&amp;gt;&lt;br /&gt;&amp;lt;/apex:pageblock&amp;gt;&lt;br /&gt;&amp;lt;/apex:page&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;In this Controller I have developed a procedure "getObjPicklistValues" which receives a DescribeFieldResult object as parameter, corresponding to the picklist I want to show in the filter components' area. DescribeFieldResult methods provide you with most reflection capabilities you require to be able to programmatically write reusable codes (as you can see in this example).&lt;br /&gt;&lt;br /&gt;The other benefit that previously was not an option in Visualforce is Dynamic Apex. Now you can build your query based on user's choices on the fly, then run it against Salesforce database and view the customized data to the user.&lt;br /&gt;&lt;br /&gt;In this example, if the user is not entering any value for Account Name or has not chosen any Account type, then simply those fields will not be queried and will be excluded from the SOQL statement.&lt;br /&gt;&lt;br /&gt;And the controller's code:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;b:includable id="somethingelse"&gt;&lt;div style="OVERFLOW: auto; WIDTH: 98%; HEIGHT: 400px; BACKGROUND-COLOR: rgb(245,245,240)"&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;color:blue;"&gt;public&lt;/span&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; myPageController {&lt;?xml:namespace prefix = o /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; List&lt;account&gt; accountResults;&lt;o:p&gt;&lt;/o:p&gt;&lt;/account&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; List&lt;account&gt; getAccountResults() {&lt;o:p&gt;&lt;/o:p&gt;&lt;/account&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; accountResults;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; String searchText&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;get&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;set&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; String accountType&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;get&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;set&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; String accountOwnership&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;get&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;set&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; String resultNo&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;get&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;set&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; List&lt;selectoption&gt; getAccountTypes()&lt;o:p&gt;&lt;/o:p&gt;&lt;/selectoption&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; getObjPicklistValues(Account.Type.getDescribe());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; List&lt;selectoption&gt; getAccountOwnerships()&lt;o:p&gt;&lt;/o:p&gt;&lt;/selectoption&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; getObjPicklistValues(Account.Ownership.getDescribe());&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; List&lt;selectoption&gt; getObjPicklistValues(Schema.DescribeFieldResult picklistDesc)&lt;o:p&gt;&lt;/o:p&gt;&lt;/selectoption&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;List&lt;schema.picklistentry&gt; pList = picklistDesc.getPicklistValues();&lt;o:p&gt;&lt;/o:p&gt;&lt;/SCHEMA.PICKLISTENTRY&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;List&lt;selectoption&gt; items = &lt;span style="color:blue;"&gt;new&lt;/span&gt; List&lt;selectoption&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/selectoption&gt;&lt;/selectoption&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;items.add(&lt;span style="color:blue;"&gt;new&lt;/span&gt; SelectOption(&lt;span style="COLOR: rgb(163,21,21)"&gt;''&lt;/span&gt;,&lt;span style="COLOR: rgb(163,21,21)"&gt;'--None--'&lt;/span&gt;));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;for&lt;/span&gt; (Schema.PicklistEntry pl : pList) {&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;items.add(&lt;span style="color:blue;"&gt;new&lt;/span&gt; SelectOption(pl.getValue(),pl.getLabel()));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; items;&lt;span style="font-size:0;"&gt; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; PageReference search()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;String query = &lt;span style="COLOR: rgb(163,21,21)"&gt;'Select name, type, ownership, industry from account '&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;String queryLimit = &lt;span style="COLOR: rgb(163,21,21)"&gt;' limit '&lt;/span&gt; + resultNo;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;String conditions = &lt;span style="COLOR: rgb(163,21,21)"&gt;''&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (searchText != &lt;span style="color:blue;"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; searchText != &lt;span style="COLOR: rgb(163,21,21)"&gt;''&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;conditions += &lt;span style="COLOR: rgb(163,21,21)"&gt;' name LIKE \''&lt;/span&gt; + searchText + &lt;span style="COLOR: rgb(163,21,21)"&gt;'%\''&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (accountType != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (conditions != &lt;span style="COLOR: rgb(163,21,21)"&gt;''&lt;/span&gt;) conditions+= &lt;span style="COLOR: rgb(163,21,21)"&gt;' and '&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;conditions += &lt;span style="COLOR: rgb(163,21,21)"&gt;' Type = \''&lt;/span&gt; + accountType + &lt;span style="COLOR: rgb(163,21,21)"&gt;'\''&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;} &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (accountOwnership != &lt;span style="color:blue;"&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (conditions != &lt;span style="COLOR: rgb(163,21,21)"&gt;''&lt;/span&gt;) conditions+= &lt;span style="COLOR: rgb(163,21,21)"&gt;' and '&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;conditions += &lt;span style="COLOR: rgb(163,21,21)"&gt;' Ownership = \''&lt;/span&gt; + accountOwnership + &lt;span style="COLOR: rgb(163,21,21)"&gt;'\''&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt; (conditions != &lt;span style="COLOR: rgb(163,21,21)"&gt;''&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;query += &lt;span style="COLOR: rgb(163,21,21)"&gt;' where '&lt;/span&gt; + conditions;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;query += &lt;span style="COLOR: rgb(163,21,21)"&gt;' order by CreatedDate DESC '&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;query += queryLimit; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;//apexPages.addmessage(new ApexPages.message(ApexPages.severity.INFO, query));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;accountResults = Database.query(query);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;null&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;&lt;span style="font-size:0;"&gt;&lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="MsoNormal" style="MARGIN: 0in 0in 0pt"&gt;&lt;span style="font-family:'Courier New';font-size:10;"&gt;}&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-6014840908385137125?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CYsFJE7i-dQj0zNoKOUa1q9cYBM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CYsFJE7i-dQj0zNoKOUa1q9cYBM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/CYsFJE7i-dQj0zNoKOUa1q9cYBM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CYsFJE7i-dQj0zNoKOUa1q9cYBM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/YrRuqJR5W14" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/6014840908385137125/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/10/utilizing-dynamic-apex-features-of.html#comment-form" title="4 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/6014840908385137125?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/6014840908385137125?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/YrRuqJR5W14/utilizing-dynamic-apex-features-of.html" title="Utilizing Dynamic Apex Feature in Winter 09 Release!" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_A3gbIRtV9H8/SO5ubAXyQTI/AAAAAAAAAGQ/fgtAmbUUIs8/s72-c/searchPage.jpg" height="72" width="72" /><thr:total>4</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/10/utilizing-dynamic-apex-features-of.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0IASHY6fCp7ImA9WxRXGE0.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-8878378784204658441</id><published>2008-10-07T23:30:00.006-04:00</published><updated>2008-10-23T20:52:29.814-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-23T20:52:29.814-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Components" /><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>A Picklist Component For Your Visualforce Pages</title><content type="html">The last couple of months, numerous times in order to view picklist values in a form either for filter the views or creating custom data entry forms, I had to come up with ways to get around the limitations and somehow hook the inputField with the picklist to show what I needed.&lt;br /&gt;&lt;br /&gt;Now, with the Salesforce Winter 09 improvements now it is much easier to tackle this issue.&lt;br /&gt;&lt;br /&gt;In this article we will design an Apex component that gets the picklist name as attribute and renders the picklist values in form of a dropdown list.&lt;br /&gt;&lt;br /&gt;This component will be really useful for non-multi-select picklists. I will post another article on multiselect picklists in near future.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;Let's see how the Component will be added to the Page:&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 100px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);"&gt;&amp;lt;c:picklist&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;id&lt;/span&gt;=&lt;span style="color: rgb(0, 102, 0);"&gt;"industryPicklist"&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;value&lt;/span&gt;=&lt;span style="color: rgb(0, 102, 0);"&gt;"{!accountIndustry}"&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;picklistField&lt;/span&gt;=&lt;span style="color: rgb(0, 102, 0);"&gt;"Industry"&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;systemEntity&lt;/span&gt;=&lt;span style="color: rgb(0, 102, 0);"&gt;"Account"&lt;/span&gt; &lt;span style="color: rgb(0, 0, 153);"&gt;usedefaultvalue&lt;/span&gt;=&lt;span style="color: rgb(0, 102, 0);"&gt;"true"&lt;span style="color: rgb(0, 0, 153);"&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/b:includable&gt;&lt;br /&gt;What you need to define for the component is what object, which picklist field of that Object and a property of your page's Controller allowing you to read what user's choice was.&lt;br /&gt;&lt;br /&gt;Now let's dive into the code and see how this component is developed. Like most other Visualforce page developments our component has two parts. The User Interface elements and the controller behind it.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&amp;lt;apex:component controller="picklistController"&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="SystemEntity" description="" type="String" required="true" default="Account" assignTo="{!systemObject}"&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="picklistField" description="" type="String" required="true" default="Type" assignTo="{!picklist_Field}"&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="value" description="" type="String" required="true"&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="defaultLabel" description="default value to be shown to user" type="String" assignTo="{!listDefaultLabel}" default="--None--"&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="defaultValue" description="default value to be shown to user" type="String" assignTo="{!listDefaultValue}" default=""&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="useDefaultValue" description="whether a default value to be shown or not" type="Boolean" assignTo="{!haveDefaultValue}" default="false"&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;apex:selectList value="{!value}" size="1"&amp;gt;&lt;br /&gt;&amp;lt;apex:selectOptions value="{!items}"&amp;gt;&amp;lt;/apex:selectOptions&amp;gt;&lt;br /&gt;&amp;lt;/apex:selectList&amp;gt;&lt;br /&gt;&amp;lt;/apex:component&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;The Component has only a selectList and a few attributes. Below are a list of attributes used for this component:&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;systemEntity&lt;/span&gt;: API name of the Object which has a picklist field&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;picklistField&lt;/span&gt;: API name of the Object's picklist field&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;value&lt;/span&gt;: This field should be bound to a property in parent Page's Controller &lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;defaultLabel&lt;/span&gt;: Label of the default value shown to user, only visible when useDefaultValue is set to true.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;defaultValue&lt;/span&gt;: Value of the default item shown to user, only visible when useDefaultValue is set to true.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;useDefaultValue&lt;/span&gt;: A Boolean value tells the component whether to show a default value or not.&lt;/li&gt;&lt;/ul&gt;Now let's see how the Controller is look like:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="controller"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710660"&gt;&lt;span style=";font-family:'Courier New';font-size:10;color:blue;" dtid="281474976710661"   &gt;public&lt;/span&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710662"  &gt; &lt;span dtid="281474976710663"  style="color:blue;"&gt;class&lt;/span&gt; picklistController {&lt;o:p dtid="281474976710664"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710665"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710666"  &gt;&lt;o:p dtid="281474976710667"&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710668"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710669"  &gt;&lt;span style="" dtid="281474976710670"&gt; &lt;/span&gt;&lt;span dtid="281474976710671"  style="color:green;"&gt;//System object name, such as Account&lt;o:p dtid="281474976710672"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710673"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710674"  &gt;&lt;span style="" dtid="281474976710675"&gt; &lt;/span&gt;&lt;span dtid="281474976710676"  style="color:blue;"&gt;private&lt;/span&gt; String systemObject;&lt;o:p dtid="281474976710677"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710678"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710679"  &gt;&lt;span style="" dtid="281474976710680"&gt; &lt;/span&gt;&lt;span dtid="281474976710681"  style="color:blue;"&gt;public&lt;/span&gt; String getSystemObject() { &lt;o:p dtid="281474976710682"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710683"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710684"  &gt;&lt;span style="" dtid="281474976710685"&gt;    &lt;/span&gt;&lt;span dtid="281474976710686"  style="color:blue;"&gt;return&lt;/span&gt; systemObject;&lt;o:p dtid="281474976710687"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710688"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710689"  &gt;&lt;span style="" dtid="281474976710690"&gt; &lt;/span&gt;}&lt;o:p dtid="281474976710691"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710692"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710693"  &gt;&lt;span style="" dtid="281474976710694"&gt; &lt;/span&gt;&lt;span dtid="281474976710695"  style="color:blue;"&gt;public&lt;/span&gt; &lt;span dtid="281474976710696"  style="color:blue;"&gt;void&lt;/span&gt; setSystemObject(String value)&lt;o:p dtid="281474976710697"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710698"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710699"  &gt;&lt;span style="" dtid="281474976710700"&gt; &lt;/span&gt;{&lt;o:p dtid="281474976710701"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710702"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710703"  &gt;&lt;span style="" dtid="281474976710704"&gt;   &lt;/span&gt;systemObject = value;&lt;o:p dtid="281474976710705"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710706"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710707"  &gt;&lt;span style="" dtid="281474976710708"&gt; &lt;/span&gt;}&lt;o:p dtid="281474976710709"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710710"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710711"  &gt;&lt;span style="" dtid="281474976710712"&gt;&lt;/span&gt;&lt;o:p dtid="281474976710713"&gt;&lt;/o:p&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710714"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710715"  &gt;&lt;span style="" dtid="281474976710716"&gt; &lt;/span&gt;&lt;span dtid="281474976710717"  style="color:green;"&gt;//picklist name such as "Type" of account  object&lt;o:p dtid="281474976710718"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710719"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710720"  &gt;&lt;span style="" dtid="281474976710721"&gt; &lt;/span&gt;&lt;span dtid="281474976710722"  style="color:blue;"&gt;private&lt;/span&gt; String picklist_Field;&lt;o:p dtid="281474976710723"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710724"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710725"  &gt;&lt;span style="" dtid="281474976710726"&gt; &lt;/span&gt;&lt;span dtid="281474976710727"  style="color:blue;"&gt;public&lt;/span&gt; String getPicklist_Field() {&lt;o:p dtid="281474976710728"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710729"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710730"  &gt;&lt;span style="" dtid="281474976710731"&gt;   &lt;/span&gt;&lt;span dtid="281474976710732"  style="color:blue;"&gt;return&lt;/span&gt; picklist_Field;&lt;o:p dtid="281474976710733"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710734"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710735"  &gt;&lt;span style="" dtid="281474976710736"&gt; &lt;/span&gt;}&lt;o:p dtid="281474976710737"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710738"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710739"  &gt;&lt;span style="" dtid="281474976710740"&gt; &lt;/span&gt;&lt;span dtid="281474976710741"  style="color:blue;"&gt;public&lt;/span&gt; &lt;span dtid="281474976710742"  style="color:blue;"&gt;void&lt;/span&gt; setPicklist_Field(String value)  {&lt;o:p dtid="281474976710743"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710744"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710745"  &gt;&lt;span style="" dtid="281474976710746"&gt;    &lt;/span&gt;picklist_Field= value;&lt;o:p dtid="281474976710747"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710748"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710749"  &gt;&lt;span style="" dtid="281474976710750"&gt; &lt;/span&gt;}&lt;o:p dtid="281474976710751"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710752"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710753"  &gt;&lt;span style="" dtid="281474976710754"&gt;&lt;/span&gt;&lt;o:p dtid="281474976710755"&gt;&lt;/o:p&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710756"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710757"  &gt;&lt;span style="" dtid="281474976710758"&gt; &lt;/span&gt;&lt;span dtid="281474976710759"  style="color:green;"&gt;//default item's value&lt;o:p dtid="281474976710760"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710761"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710762"  &gt;&lt;span style="" dtid="281474976710763"&gt; &lt;/span&gt;&lt;span dtid="281474976710764"  style="color:blue;"&gt;public&lt;/span&gt; String listDefaultValue&lt;o:p dtid="281474976710765"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710766"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710767"  &gt;&lt;span style="" dtid="281474976710768"&gt; &lt;/span&gt;{&lt;o:p dtid="281474976710769"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710770"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710771"  &gt;&lt;span style="" dtid="281474976710772"&gt;   &lt;/span&gt;&lt;span dtid="281474976710773"  style="color:blue;"&gt;get&lt;/span&gt;;&lt;o:p dtid="281474976710774"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710775"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710776"  &gt;&lt;span style="" dtid="281474976710777"&gt;   &lt;/span&gt;&lt;span dtid="281474976710778"  style="color:blue;"&gt;set&lt;/span&gt;;&lt;o:p dtid="281474976710779"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710780"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710781"  &gt;&lt;span style="" dtid="281474976710782"&gt; &lt;/span&gt;}&lt;o:p dtid="281474976710783"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710784"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710785"  &gt;&lt;span style="" dtid="281474976710786"&gt; &lt;/span&gt;&lt;span dtid="281474976710787"  style="color:green;"&gt;//default item's label&lt;o:p dtid="281474976710788"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710789"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710790"  &gt;&lt;span style="" dtid="281474976710791"&gt; &lt;/span&gt;&lt;span dtid="281474976710792"  style="color:blue;"&gt;public&lt;/span&gt; String listDefaultLabel&lt;o:p dtid="281474976710793"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710794"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710795"  &gt;&lt;span style="" dtid="281474976710796"&gt; &lt;/span&gt;{&lt;o:p dtid="281474976710797"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710798"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710799"  &gt;&lt;span style="" dtid="281474976710800"&gt;   &lt;/span&gt;&lt;span dtid="281474976710801"  style="color:blue;"&gt;get&lt;/span&gt;;&lt;o:p dtid="281474976710802"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710803"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710804"  &gt;&lt;span style="" dtid="281474976710805"&gt;   &lt;/span&gt;&lt;span dtid="281474976710806"  style="color:blue;"&gt;set&lt;/span&gt;;&lt;o:p dtid="281474976710807"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710808"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710809"  &gt;&lt;span style="" dtid="281474976710810"&gt; &lt;/span&gt;}&lt;o:p dtid="281474976710811"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710812"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710813"  &gt;&lt;span style="" dtid="281474976710814"&gt;&lt;/span&gt;&lt;o:p dtid="281474976710815"&gt;&lt;/o:p&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710816"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710817"  &gt;&lt;span style="" dtid="281474976710818"&gt; &lt;/span&gt;&lt;span dtid="281474976710819"  style="color:green;"&gt;// whether the default item should be  shown&lt;o:p dtid="281474976710820"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710821"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710822"  &gt;&lt;span style="" dtid="281474976710823"&gt; &lt;/span&gt;&lt;span dtid="281474976710824"  style="color:blue;"&gt;public&lt;/span&gt; Boolean haveDefaultValue&lt;o:p dtid="281474976710825"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710826"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710827"  &gt;&lt;span style="" dtid="281474976710828"&gt; &lt;/span&gt;{&lt;o:p dtid="281474976710829"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710830"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710831"  &gt;&lt;span style="" dtid="281474976710832"&gt;   &lt;/span&gt;&lt;span dtid="281474976710833"  style="color:blue;"&gt;get&lt;/span&gt;;&lt;o:p dtid="281474976710834"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710835"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710836"  &gt;&lt;span style="" dtid="281474976710837"&gt;   &lt;/span&gt;&lt;span dtid="281474976710838"  style="color:blue;"&gt;set&lt;/span&gt;;&lt;o:p dtid="281474976710839"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710840"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710841"  &gt;&lt;span style="" dtid="281474976710842"&gt; &lt;/span&gt;}&lt;o:p dtid="281474976710843"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710844"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710845"  &gt;&lt;o:p dtid="281474976710846"&gt;   &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710847"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710848"  &gt;&lt;span style="" dtid="281474976710849"&gt; &lt;/span&gt;&lt;span dtid="281474976710850"  style="color:blue;"&gt;public&lt;/span&gt; List&lt;selectoption&gt;  getItems()&lt;o:p dtid="281474976710851"&gt;&lt;/o:p&gt;&lt;/selectoption&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710852"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710853"  &gt;&lt;span style="" dtid="281474976710854"&gt; &lt;/span&gt;{&lt;o:p dtid="281474976710855"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710856"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710857"  &gt;&lt;span style="" dtid="281474976710858"&gt;     &lt;/span&gt;List&lt;schema.picklistentry&gt;  entries_local;&lt;o:p dtid="281474976710859"&gt;&lt;/o:p&gt;&lt;/schema.picklistentry&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710860"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710861"  &gt;&lt;span style="" dtid="281474976710862"&gt;     &lt;/span&gt;&lt;o:p dtid="281474976710863"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710864"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710865"  &gt;&lt;span style="" dtid="281474976710866"&gt;     &lt;/span&gt;&lt;span dtid="281474976710867"  style="color:blue;"&gt;if&lt;/span&gt; (systemObject != &lt;span dtid="281474976710868"  style="color:blue;"&gt;null&lt;/span&gt;)&lt;o:p dtid="281474976710869"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710870"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710871"  &gt;&lt;span style="" dtid="281474976710872"&gt;     &lt;/span&gt;{&lt;o:p dtid="281474976710873"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710874"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710875"  &gt;&lt;span style="" dtid="281474976710876"&gt;        &lt;/span&gt;&lt;span dtid="281474976710877"  style="color:green;"&gt;//use GlobalDecribe to get a list of all  available Objects&lt;o:p dtid="281474976710878"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710879"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710880"  &gt;&lt;span style="" dtid="281474976710881"&gt;        &lt;/span&gt;Map&lt;string,&gt; gd = Schema.getGlobalDescribe(); &lt;o:p dtid="281474976710882"&gt;&lt;/o:p&gt;&lt;/string,&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710883"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710884"  &gt;&lt;span style="" dtid="281474976710885"&gt;        &lt;/span&gt;Set&lt;string&gt; objectKeys =  gd.keySet();&lt;o:p dtid="281474976710886"&gt;&lt;/o:p&gt;&lt;/string&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710887"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710888"  &gt;&lt;span style="" dtid="281474976710889"&gt;        &lt;/span&gt;&lt;span dtid="281474976710890"  style="color:blue;"&gt;for&lt;/span&gt;(String objectKey: objectKeys)&lt;o:p dtid="281474976710891"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710892"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710893"  &gt;&lt;span style="" dtid="281474976710894"&gt;        &lt;/span&gt;{ &lt;o:p dtid="281474976710895"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710896"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710897"  &gt;&lt;span style="" dtid="281474976710898"&gt;            &lt;/span&gt;&lt;span dtid="281474976710899"  style="color:green;"&gt;//Iterate through all objects to locate  selected Object&lt;o:p dtid="281474976710900"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710901"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710902"  &gt;&lt;span style="" dtid="281474976710903"&gt;            &lt;/span&gt;&lt;span dtid="281474976710904"  style="color:blue;"&gt;if&lt;/span&gt; (objectKey ==  systemObject.toLowerCase())&lt;o:p dtid="281474976710905"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710906"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710907"  &gt;&lt;span style="" dtid="281474976710908"&gt;            &lt;/span&gt;{&lt;o:p dtid="281474976710909"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710910"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710911"  &gt;&lt;span style="" dtid="281474976710912"&gt;                &lt;/span&gt;Schema.SObjectType  systemObjectType =&lt;span style="" dtid="281474976710913"&gt;  &lt;/span&gt;gd.get(objectKey);&lt;o:p dtid="281474976710914"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710915"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710916"  &gt;&lt;span style="" dtid="281474976710917"&gt;                 &lt;/span&gt;Schema.DescribeSObjectResult r = systemObjectType.getDescribe();&lt;o:p dtid="281474976710918"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710919"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710920"  &gt;&lt;span style="" dtid="281474976710921"&gt;                &lt;/span&gt;Map&lt;string,&gt; M = r.fields.getMap();&lt;o:p dtid="281474976710922"&gt;&lt;/o:p&gt;&lt;/string,&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710923"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710924"  &gt;&lt;span style="" dtid="281474976710925"&gt;                &lt;/span&gt;Set&lt;string&gt;  fieldNames = M.keySet();&lt;o:p dtid="281474976710926"&gt;&lt;/o:p&gt;&lt;/string&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710927"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710928"  &gt;&lt;span style="" dtid="281474976710929"&gt;                &lt;/span&gt;&lt;span dtid="281474976710930"  style="color:blue;"&gt;if&lt;/span&gt; (picklist_Field  == &lt;span dtid="281474976710931"  style="color:blue;"&gt;null&lt;/span&gt;) &lt;o:p dtid="281474976710932"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710933"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710934"  &gt;&lt;span style="" dtid="281474976710935"&gt;                &lt;/span&gt;{&lt;o:p dtid="281474976710936"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710937"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710938"  &gt;&lt;span style="" dtid="281474976710939"&gt;                   &lt;/span&gt;&lt;span dtid="281474976710940"  style="color:blue;"&gt;break&lt;/span&gt;;&lt;o:p dtid="281474976710941"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710942"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710943"  &gt;&lt;span style="" dtid="281474976710944"&gt;                &lt;/span&gt;}&lt;o:p dtid="281474976710945"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710946"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710947"  &gt;&lt;span style="" dtid="281474976710948"&gt;                &lt;/span&gt;&lt;span dtid="281474976710949"  style="color:green;"&gt;//iterate through all  fields of the object to locate the picklist field&lt;o:p dtid="281474976710950"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710951"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710952"  &gt;&lt;span style="" dtid="281474976710953"&gt;                &lt;/span&gt;&lt;span dtid="281474976710954"  style="color:blue;"&gt;for&lt;/span&gt;(String  fieldName: fieldNames)&lt;o:p dtid="281474976710955"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710956"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710957"  &gt;&lt;span style="" dtid="281474976710958"&gt;                &lt;/span&gt;{&lt;o:p dtid="281474976710959"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710960"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710961"  &gt;&lt;span style="" dtid="281474976710962"&gt;                    &lt;/span&gt;&lt;span dtid="281474976710963"  style="color:blue;"&gt;if&lt;/span&gt; (fieldName ==  picklist_Field.toLowerCase())&lt;o:p dtid="281474976710964"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710965"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710966"  &gt;&lt;span style="" dtid="281474976710967"&gt;                    &lt;/span&gt;{&lt;o:p dtid="281474976710968"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710969"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710970"  &gt;&lt;span style="" dtid="281474976710971"&gt;                        &lt;/span&gt;Schema.SObjectField field = M.get(fieldName);&lt;o:p dtid="281474976710972"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710973"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710974"  &gt;&lt;span style="" dtid="281474976710975"&gt;                        &lt;/span&gt;Schema.DescribeFieldResult fieldDesc = field.getDescribe();&lt;o:p dtid="281474976710976"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710977"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710978"  &gt;&lt;span style="" dtid="281474976710979"&gt;                       &lt;/span&gt;&lt;span dtid="281474976710980"  style="color:green;"&gt;//extract the picklist  values&lt;o:p dtid="281474976710981"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710982"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710983"  &gt;&lt;span style="" dtid="281474976710984"&gt;                       &lt;/span&gt;entries_local =  fieldDesc.getPicklistValues();&lt;o:p dtid="281474976710985"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710986"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710987"  &gt;&lt;span style="" dtid="281474976710988"&gt;                       &lt;/span&gt;&lt;span dtid="281474976710989"  style="color:blue;"&gt;break&lt;/span&gt;;&lt;o:p dtid="281474976710990"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710991"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710992"  &gt;&lt;span style="" dtid="281474976710993"&gt;                    &lt;/span&gt;}&lt;o:p dtid="281474976710994"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710995"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976710996"  &gt;&lt;span style="" dtid="281474976710997"&gt;                &lt;/span&gt;}&lt;o:p dtid="281474976710998"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976710999"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711000"  &gt;&lt;span style="" dtid="281474976711001"&gt;            &lt;/span&gt;}&lt;o:p dtid="281474976711002"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711003"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711004"  &gt;&lt;span style="" dtid="281474976711005"&gt;        &lt;/span&gt;}&lt;span dtid="281474976711006"  style="color:green;"&gt;//end for &lt;o:p dtid="281474976711007"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711008"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711009"  &gt;&lt;span style="" dtid="281474976711010"&gt;     &lt;/span&gt;}&lt;o:p dtid="281474976711011"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711012"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711013"  &gt;&lt;span style="" dtid="281474976711014"&gt;     &lt;/span&gt;&lt;o:p dtid="281474976711015"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711016"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711017"  &gt;&lt;span style="" dtid="281474976711018"&gt;     &lt;/span&gt;&lt;span dtid="281474976711019"  style="color:green;"&gt;//Loading the picklist values and default item  for our selectList&lt;o:p dtid="281474976711020"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711021"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711022"  &gt;&lt;span style="" dtid="281474976711023"&gt;     &lt;/span&gt;List&lt;selectoption&gt; options =  &lt;span dtid="281474976711024"  style="color:blue;"&gt;new&lt;/span&gt;  List&lt;selectoption&gt;();&lt;o:p dtid="281474976711025"&gt;&lt;/o:p&gt;&lt;/selectoption&gt;&lt;/selectoption&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711026"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711027"  &gt;&lt;span style="" dtid="281474976711028"&gt;     &lt;/span&gt;&lt;o:p dtid="281474976711029"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711030"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711031"  &gt;&lt;span style="" dtid="281474976711032"&gt;     &lt;/span&gt;&lt;span dtid="281474976711033"  style="color:green;"&gt;//take care of Default value &lt;o:p dtid="281474976711034"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711035"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711036"  &gt;&lt;span style="" dtid="281474976711037"&gt;     &lt;/span&gt;&lt;span dtid="281474976711038"  style="color:blue;"&gt;if&lt;/span&gt; (haveDefaultValue == &lt;span dtid="281474976711039"  style="color:blue;"&gt;true&lt;/span&gt;)&lt;o:p dtid="281474976711040"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711041"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711042"  &gt;&lt;span style="" dtid="281474976711043"&gt;     &lt;/span&gt;{&lt;o:p dtid="281474976711044"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711045"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711046"  &gt;&lt;span style="" dtid="281474976711047"&gt;        &lt;/span&gt;&lt;span dtid="281474976711048"  style="color:blue;"&gt;if&lt;/span&gt; (listDefaultValue == &lt;span dtid="281474976711049"  style="color:blue;"&gt;null&lt;/span&gt;) &lt;o:p dtid="281474976711050"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711051"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711052"  &gt;&lt;span style="" dtid="281474976711053"&gt;            &lt;/span&gt;listDefaultValue = &lt;span style="color: rgb(163, 21, 21);" dtid="281474976711054"&gt;''&lt;/span&gt;;&lt;o:p dtid="281474976711055"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711056"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711057"  &gt;&lt;span style="" dtid="281474976711058"&gt;        &lt;/span&gt;&lt;span dtid="281474976711059"  style="color:blue;"&gt;if&lt;/span&gt; (listDefaultLabel== &lt;span dtid="281474976711060"  style="color:blue;"&gt;null&lt;/span&gt;)&lt;o:p dtid="281474976711061"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711062"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711063"  &gt;&lt;span style="" dtid="281474976711064"&gt;            &lt;/span&gt;listDefaultLabel = &lt;span style="color: rgb(163, 21, 21);" dtid="281474976711065"&gt;'--None--'&lt;/span&gt;;&lt;o:p dtid="281474976711066"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711067"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711068"  &gt;&lt;span style="" dtid="281474976711069"&gt;        &lt;/span&gt;options.add(&lt;span dtid="281474976711070"  style="color:blue;"&gt;new&lt;/span&gt;  SelectOption(listDefaultValue,listDefaultLabel));&lt;o:p dtid="281474976711071"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711072"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711073"  &gt;&lt;span style="" dtid="281474976711074"&gt;     &lt;/span&gt;}&lt;o:p dtid="281474976711075"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711076"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711077"  &gt;&lt;span style="" dtid="281474976711078"&gt;     &lt;/span&gt;&lt;o:p dtid="281474976711079"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711080"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711081"  &gt;&lt;span style="" dtid="281474976711082"&gt;     &lt;/span&gt;&lt;span dtid="281474976711083"  style="color:green;"&gt;//take care of picklist values &lt;o:p dtid="281474976711084"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711085"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711086"  &gt;&lt;span style="" dtid="281474976711087"&gt;     &lt;/span&gt;&lt;span dtid="281474976711088"  style="color:blue;"&gt;if&lt;/span&gt; (entries_local != &lt;span dtid="281474976711089"  style="color:blue;"&gt;null&lt;/span&gt;)&lt;o:p dtid="281474976711090"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711091"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711092"  &gt;&lt;span style="" dtid="281474976711093"&gt;     &lt;/span&gt;{&lt;o:p dtid="281474976711094"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711095"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711096"  &gt;&lt;span style="" dtid="281474976711097"&gt;         &lt;/span&gt;&lt;span dtid="281474976711098"  style="color:blue;"&gt;for&lt;/span&gt;(Schema.PicklistEntry picklistItem :  entries_local)&lt;o:p dtid="281474976711099"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711100"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711101"  &gt;&lt;span style="" dtid="281474976711102"&gt;         &lt;/span&gt;{&lt;o:p dtid="281474976711103"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711104"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711105"  &gt;&lt;span style="" dtid="281474976711106"&gt;             &lt;/span&gt;options.add(&lt;span dtid="281474976711107"  style="color:blue;"&gt;new&lt;/span&gt;  SelectOption(picklistItem.getValue(),picklistItem.getLabel()));&lt;o:p dtid="281474976711108"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711109"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711110"  &gt;&lt;span style="" dtid="281474976711111"&gt;         &lt;/span&gt;}&lt;span style="" dtid="281474976711112"&gt;  &lt;/span&gt;&lt;o:p dtid="281474976711113"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711114"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711115"  &gt;&lt;span style="" dtid="281474976711116"&gt;     &lt;/span&gt;}&lt;o:p dtid="281474976711117"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711118"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711119"  &gt;&lt;span style="" dtid="281474976711120"&gt;        &lt;/span&gt;&lt;o:p dtid="281474976711121"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711122"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711123"  &gt;&lt;span style="" dtid="281474976711124"&gt;     &lt;/span&gt;&lt;span dtid="281474976711125"  style="color:blue;"&gt;return&lt;/span&gt; options;&lt;o:p dtid="281474976711126"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711127"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711128"  &gt;&lt;span style="" dtid="281474976711129"&gt;  &lt;/span&gt;}&lt;o:p dtid="281474976711130"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711131"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711132"  &gt;&lt;span style="" dtid="281474976711133"&gt;  &lt;/span&gt;&lt;o:p dtid="281474976711134"&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711135"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711136"  &gt;&lt;span style="" dtid="281474976711137"&gt;&lt;/span&gt;&lt;o:p dtid="281474976711138"&gt;&lt;/o:p&gt;&lt;/span&gt; &lt;/p&gt;&lt;p style="margin: 0in 0in 0pt;" class="MsoNormal" dtid="281474976711139"&gt;&lt;span style=";font-family:'Courier New';font-size:10;" dtid="281474976711140"  &gt;}&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-8878378784204658441?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/b_VDCvWP_0TI77CD8YHFlp9ksnw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/b_VDCvWP_0TI77CD8YHFlp9ksnw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/b_VDCvWP_0TI77CD8YHFlp9ksnw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/b_VDCvWP_0TI77CD8YHFlp9ksnw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/dzd89gslpHk" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/8878378784204658441/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/10/picklist-component-for-your-visualforce.html#comment-form" title="13 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/8878378784204658441?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/8878378784204658441?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/dzd89gslpHk/picklist-component-for-your-visualforce.html" title="A Picklist Component For Your Visualforce Pages" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><thr:total>13</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/10/picklist-component-for-your-visualforce.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcASXozeyp7ImA9WxRQEk0.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-3499582740312921383</id><published>2008-10-02T18:04:00.006-04:00</published><updated>2008-10-05T07:44:08.483-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-05T07:44:08.483-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>A Visualforce Component that Beautifies actionStatus!</title><content type="html">I have always liked to be able to have one of those fancy AJAX "loading..." messages for my AJAX postback calls. The background screen grays out, all components (textboxes, buttons, etc) become disabled and a little box says "Working on your request..." or "Running..." with that famous GIF animator of a spinning wheel and hey, I finally did it!&lt;br /&gt;&lt;br /&gt;In this article I will show how to design the HTML to place the loading message into the center of the screen and gray out the background and the whole nine yards...&lt;br /&gt;&lt;br /&gt;In this example I will first create a Visualforce component so that potentially I could use my beautiful "loading..." message on every page I desire, furthermore by forming it as a Component I can parameterize the look and feel of it and easily deploy it into different pages with different coloring styles.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_A3gbIRtV9H8/SOVLx964DaI/AAAAAAAAAFQ/J5kc87snf1M/s1600-h/Component.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://3.bp.blogspot.com/_A3gbIRtV9H8/SOVLx964DaI/AAAAAAAAAFQ/J5kc87snf1M/s400/Component.jpg" alt="" id="BLOGGER_PHOTO_ID_5252687862204730786" border="0" /&gt;&lt;/a&gt;In order to create a new Component click on the "setup" link on the right top corner of the page and find "Develop" item on the left hand-side and expand it, and click on "Components". Alternatively you can browse:&lt;br /&gt;http://yourinstance.salesforce.ccom/apexcomponent/{YourComponentName}&lt;br /&gt;&lt;br /&gt;Below you will be to get the code that goes into the component. The HTML code includes two Div elements, one for the gray background and the other for the actual box that the message is shown in and a javascript peice that adjusts the sizes of the div element based on the client browser's resolution and avialable place.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&amp;lt;apex:component &amp;gt;&lt;br /&gt;&amp;lt;!-- Attribute Definitions --&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="BorderColor" type="String" required="true" description=""&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="Width" type="String" required="true" description=""&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="Height" type="String" required="true" description=""&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="BackColor" type="String" required="true" description=""&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="BackColor" type="String" required="true" description=""&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="BorderSize" type="String" required="true" description=""&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="ImageUrl" type="String" required="false" description=""&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="Message" type="String" required="false" description=""&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="messageStyle" type="String" required="false" description="Message inline style"&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&amp;lt;apex:attribute name="BorderStyle" type="String" required="false" description="Message box border style: solid, outset, inset, etc"&amp;gt;&amp;lt;/apex:attribute&amp;gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;div id="salesforceSource_blurybackground" style="position:absolute; left:1px; top:1px; width:100%; height:100%; text-align:center; vertical-align: middle; background-color: #dcdcdc; opacity:0.6;filter:alpha(opacity=60)"&amp;gt;&lt;br /&gt; &amp;lt;/div&amp;gt;&lt;br /&gt; &amp;lt;div id="salesFroceSource_StatusBox" style="position:absolute; left:100px; top: 100px;width: {!Width}; height:{!Height}; opacity:1;filter:alpha(opacity=100)"&amp;gt;&lt;br /&gt;     &amp;lt;table  border="{!BorderSize}" cellpadding="0" cellspacing="0" style="border-left-color: {!BorderColor};&lt;br /&gt;       border-bottom-color: {!BorderColor}; width: {!Width}; border-top-color: {!BorderColor}; height:{!Height};&lt;br /&gt;       border-right-color:{!BorderColor}; border-style:{!BorderStyle}; background-color:{!BackColor};"&amp;gt;&lt;br /&gt;       &amp;lt;tr&amp;gt;&lt;br /&gt;           &amp;lt;td align="left" valign="top"&amp;gt;&lt;br /&gt;               &amp;lt;table border="0" cellpadding="4" cellspacing="0" style="width: 100%; height: 100%"&amp;gt;&lt;br /&gt;                   &amp;lt;tr&amp;gt;&lt;br /&gt;                       &amp;lt;td style="border-bottom-color:{!BorderColor}; border-bottom-width:1px; border-bottom-style:solid;vertical-align:middle;"&amp;gt;&lt;br /&gt;                       &amp;lt;img src="{!ImageUrl}"/&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;                       &amp;lt;td style="border-bottom-color:{!BorderColor}; border-bottom-width:1px; border-bottom-style:solid;vertical-align:middle;{!messageStyle}"&amp;gt;&lt;br /&gt;                           &amp;amp;nbsp;{!Message}&amp;lt;/td&amp;gt;&lt;br /&gt;                   &amp;lt;/tr&amp;gt;&lt;br /&gt;               &amp;lt;/table&amp;gt;&lt;br /&gt;           &amp;lt;/td&amp;gt;&lt;br /&gt;       &amp;lt;/tr&amp;gt;&lt;br /&gt;    &amp;lt;/table&amp;gt; &lt;br /&gt;  &amp;lt;/div&amp;gt;&lt;br /&gt;  &amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;  var AgreementForm = document.getElementById("salesforceSource_blurybackground");&lt;br /&gt;  AgreementForm.style.height = window.screen.availHeight + "px";&lt;br /&gt;  AgreementForm.style.width = window.screen.availWidth + "px";&lt;br /&gt;      &lt;br /&gt;   var ContainerElem = document.getElementById("salesFroceSource_StatusBox");&lt;br /&gt;   //ContainerElem.style.display = "block";&lt;br /&gt;   AlignToCenter(ContainerElem);&lt;br /&gt;&lt;br /&gt;function AlignToCenter(Element)&lt;br /&gt;{&lt;br /&gt;   var availableHeight = 0;&lt;br /&gt;   var availableWidth = 0;&lt;br /&gt;   if (Element.ownerDocument)&lt;br /&gt;   {&lt;br /&gt;       var docElement = Element.ownerDocument.documentElement;&lt;br /&gt;       availableHeight = parseInt(docElement.clientHeight);&lt;br /&gt;       if (availableHeight == "NaN") availableHeight = 0;&lt;br /&gt;      &lt;br /&gt;       availableWidth = parseInt(docElement.clientWidth);&lt;br /&gt;       if (availableWidth == "NaN") availableWidth = 0;&lt;br /&gt;   }&lt;br /&gt;  &lt;br /&gt;   if (availableHeight == 0 || availableHeight == "NaN")&lt;br /&gt;      availableHeight = window.screen.availHeight - 200;&lt;br /&gt;   if (availableWidth == 0 || availableWidth == "NaN")&lt;br /&gt;      availableWidth = window.screen.availWidth - 100;&lt;br /&gt;  &lt;br /&gt;   var msgBoxTop = parseInt((availableHeight - parseInt(Element.clientHeight))/2);&lt;br /&gt;   var msgBoxleft = parseInt((availableWidth - parseInt(Element.style.width))/2);&lt;br /&gt;  &lt;br /&gt;   if (msgBoxTop == "NaN" || msgBoxTop == 0)&lt;br /&gt;     msgBoxTop = 100;&lt;br /&gt;  &lt;br /&gt;   Element.style.left = msgBoxleft + "px";&lt;br /&gt;   Element.style.top = msgBoxTop + "px";&lt;br /&gt; }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/apex:component&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;Pay a good attention to the Attribute section of the of the component those lines will empower you to change the look of the component entirely!&lt;br /&gt;&lt;br /&gt;Ok, Now let's see how we can use this component. In Force.com in order to call your component you will need to call it a prefix tag called "c" and don't ask why because that's the way it is.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 150px; background-color: rgb(245, 245, 240);"&gt;&amp;lt;apex:actionStatus id=&amp;quot;status&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;apex:facet name=&amp;quot;start&amp;quot;&amp;gt;&lt;br /&gt;   &amp;lt;c:enhancedActionStatus BackColor=&amp;quot;#efefef&amp;quot; borderColor=&amp;quot;#336699&amp;quot; borderSize=&amp;quot;3&amp;quot; height=&amp;quot;50px&amp;quot; width=&amp;quot;120px&amp;quot; ImageUrl=&amp;quot;{!$Resource.AjaxAnimation}&amp;quot;  Message=&amp;quot;Loading...&amp;quot; messageStyle=&amp;quot;color:darkred;font-size:11pt;font-weight:bold;&amp;quot;/&amp;gt;&lt;br /&gt; &amp;lt;/apex:facet&amp;gt;&lt;br /&gt;&amp;lt;/apex:actionStatus&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-3499582740312921383?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/8gHfsZV8X8aD9IfbKqv1qG1-EkY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8gHfsZV8X8aD9IfbKqv1qG1-EkY/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/8gHfsZV8X8aD9IfbKqv1qG1-EkY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/8gHfsZV8X8aD9IfbKqv1qG1-EkY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/Z-Z1NT8a28A" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/3499582740312921383/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/10/visualforce-component-that-beautifies.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/3499582740312921383?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/3499582740312921383?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/Z-Z1NT8a28A/visualforce-component-that-beautifies.html" title="A Visualforce Component that Beautifies actionStatus!" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_A3gbIRtV9H8/SOVLx964DaI/AAAAAAAAAFQ/J5kc87snf1M/s72-c/Component.jpg" height="72" width="72" /><thr:total>9</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/10/visualforce-component-that-beautifies.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkABR3Y6fip7ImA9WxRRGUw.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-4148070125414123020</id><published>2008-10-01T21:02:00.010-04:00</published><updated>2008-10-01T23:39:16.816-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-01T23:39:16.816-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>How To Mass Update All Your Object's Data?</title><content type="html">We know all too well that in many cases organizations have way above 8000 Account records after couple of years of using &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_0"&gt;Salesforce&lt;/span&gt; &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_1"&gt;CRM&lt;/span&gt; and this number in even higher when we talk about Contacts, Opportunities, Tasks, etc.&lt;br /&gt;&lt;br /&gt;Many &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_2"&gt;Salesforce&lt;/span&gt; partners have provided solutions to mass update/insert data into your objects, but more often you are required to examine data and make sure about its &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_3"&gt;integrity&lt;/span&gt; and soundness.&lt;br /&gt;&lt;br /&gt;Limitations:&lt;br /&gt;Based on governing limitation provided by force.com platform:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;You can only &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_4"&gt;retrieve&lt;/span&gt; 1000 records at a time&lt;/li&gt;&lt;li&gt;You can only update/insert/delete 100 records at a time&lt;/li&gt;&lt;/ul&gt;Luckily, there is something that you can do about this on your own. By doing a little bit more extra programming, use of &lt;span class="blsp-spelling-error" id="SPELLING_ERROR_5"&gt;visualforce&lt;/span&gt; components and apex Triggers you can overcome this problem.&lt;br /&gt;&lt;img id="BLOGGER_PHOTO_ID_5252389217585115810" style="DISPLAY: block; MARGIN: 0px auto 10px; CURSOR: hand; TEXT-ALIGN: center" alt="" src="http://1.bp.blogspot.com/_A3gbIRtV9H8/SOQ8KkBAsqI/AAAAAAAAAFI/OKv_h6MUz78/s400/acconthierarchy.jpg" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The solution won't be as fast, but it will work!&lt;/p&gt;&lt;p&gt;Let's explore our &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_6"&gt;example&lt;/span&gt; here: Let's say we need to check all of our Account records and make sure Parent child relationship between our Accounts are &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_7"&gt;correctly&lt;/span&gt; in place.&lt;/p&gt;&lt;p&gt;In order to enforce that let's say we have added Dun &amp;amp; Bradstreet ID and Parent Dun &amp;amp; Bradstreet ID numbers as custom fields to our Account object.&lt;/p&gt;&lt;p&gt;Therefore, if the D&amp;amp;B Parent ID has a value but the Parent Account field is empty we have a broken link. I should point out here that the above is just an example, however you may have any type of logic to validate individual objects records, checking Accounts agaist Opportunities, Quotes against Invoices, etc.&lt;/p&gt;&lt;p&gt;Here is the idea, I have over 12,000 records to process and this is well above the governing limits. So if I could divide the task into &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_8"&gt;smaller&lt;/span&gt; number of records and process each at a time then I could iterate through the records and fix them one by one without &lt;span class="blsp-spelling-corrected" id="SPELLING_ERROR_9"&gt;hitting&lt;/span&gt; into any limits.&lt;/p&gt;&lt;p&gt;So, I added an integer flag custom field to Account object to mark those I fix and move on through the further records in the next iterations.&lt;/p&gt;&lt;p&gt;I employ an actionPoller that runs every 10 seconds that triggers my operation of processing my Account records in batches of 50. The actionPoller is deactivate in the begining and can become activated via a button "Start". The same button will be able stop the process.&lt;/p&gt;&lt;p&gt;I follow this logic, at first I select the first 50 accounts which do not have parent but do have Parent D&amp;amp;B number and I will try to locate the Account Id of the parent via "Parent D&amp;amp;B number" if not sucessful I mark the Account Heirarchy status as "Broken Link" (for reporting purposes), if the parent was not found I mark the Account Heirarchy Status as "Parent Missing" and if everything was ok then I link up the Account to its parent.&lt;/p&gt;&lt;p&gt;Here the how the page code looks like:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;?xml:namespace prefix = b /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="OVERFLOW: auto; WIDTH: 98%; HEIGHT: 400px; BACKGROUND-COLOR: rgb(245,245,240)"&gt;&amp;lt;apex:page controller="AccountHierarchyBuilderCon" tabStyle="Account"&amp;gt;&lt;br /&gt;&amp;lt;apex:sectionHeader title="Account Hierarchy Builder"&amp;gt;&amp;lt;/apex:sectionHeader&amp;gt;&lt;br /&gt;&amp;lt;apex:form &amp;gt;&lt;br /&gt;&amp;lt;apex:pageBlock title="{!StatusText}" id="pageBlock"&amp;gt;&lt;br /&gt;&amp;lt;apex:pageBlockButtons &amp;gt;&lt;br /&gt;&amp;lt;apex:commandButton value="{!buttonCaption}" action="{!TaggleActionPoller}" id="theButton"&amp;gt;&amp;lt;/apex:commandButton&amp;gt;&lt;br /&gt;&amp;lt;apex:commandButton value="Launch Reports" action="{!LaunchReports}" id="ButtonReports" disabled="{!actionPollerEnabled}"&amp;gt;&amp;lt;/apex:commandButton&amp;gt;&lt;br /&gt;&amp;lt;apex:commandButton value="Clean up" action="{!UpdateAccounts}" id="secButton" disabled="{!actionPollerEnabled}" onclick="return window.confirm('Removing status values will prepare this tool to re-examine invalid hierarchies. Are you sure about this?');"&amp;gt;&amp;lt;/apex:commandButton&amp;gt;&lt;br /&gt;&amp;lt;apex:commandButton value="Clean up All" action="{!UpdateAccountsAll}" id="CleanAllButton" disabled="{!actionPollerEnabled}" onclick="return window.confirm('Removing all status values will prepare this tool to start over. Are you sure about this?');"&amp;gt;&amp;lt;/apex:commandButton&amp;gt;&lt;br /&gt;&amp;lt;/apex:pageBlockButtons&amp;gt;&lt;br /&gt;&amp;lt;apex:actionPoller enabled="{!actionPollerEnabled}" interval="10" action="{!RunBatch}" rerender="pageBlock" status="status"&amp;gt;&amp;lt;/apex:actionPoller&amp;gt;&lt;br /&gt;&amp;lt;apex:actionStatus id="status" startText="Working on the next batch..."&amp;gt;&amp;lt;/apex:actionStatus&amp;gt;&lt;br /&gt;&amp;lt;br/&amp;gt;&lt;br /&gt;&amp;lt;apex:pageBlockSection columns="1" id="resultsBlock"&amp;gt;&lt;br /&gt;&amp;lt;apex:pageMessages /&amp;gt;&lt;br /&gt;&amp;lt;div style="background-color:white;display:{!IF(invalidAccountSize=0,'none','block')};"&amp;gt; List of Invalid Accounts:&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;apex:pageBlockTable value="{!invalidAccounts}" var="a" title="Current Invalid Records" rendered="{!NOT(invalidAccountSize=0)}"&amp;gt;&lt;br /&gt;&amp;lt;apex:column value="{!a.Id}" &amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;&amp;lt;apex:column value="{!a.Name}" &amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;&amp;lt;apex:column value="{!a.parent_D_B_number__c}"&amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;&amp;lt;apex:column value="{!a.Hierarchy_Status__c}"&amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;&amp;lt;/apex:pageBlockTable&amp;gt;&lt;br /&gt;&amp;lt;/apex:pageBlockSection&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/apex:pageBlock&amp;gt;&lt;br /&gt;&amp;lt;/apex:form&amp;gt;&lt;br /&gt;&amp;lt;/apex:page&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;As you observed in the code, I have added a pageBlockTable component to show the invalid Accounts (Broken Links or missing parents) to the user between the intervals.&lt;br /&gt;&lt;br /&gt;Here is the controller's code:&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="OVERFLOW: auto; WIDTH: 98%; HEIGHT: 400px; BACKGROUND-COLOR: rgb(245,245,240)"&gt;public class AccountHierarchyBuilderCon {&lt;br /&gt;private Boolean pisWorking;&lt;br /&gt;private Boolean pActionPollerEnabled;&lt;br /&gt;private Integer ptotalRecords;&lt;br /&gt;private Integer ptotalProcessed;&lt;br /&gt;private List&lt;account&gt; InvalidAccounts;&lt;br /&gt;private String pbuttonCaption;&lt;br /&gt;private Integer pTotalModified;&lt;br /&gt;private Boolean pIsTesting = false;&lt;br /&gt;&lt;br /&gt;public AccountHierarchyBuilderCon()&lt;br /&gt;{&lt;br /&gt;InvalidAccounts = new List&lt;account&gt;();&lt;br /&gt;pisWorking = false;&lt;br /&gt;pbuttonCaption = 'Start';&lt;br /&gt;pActionPollerEnabled = false;&lt;br /&gt;ptotalProcessed = 0;&lt;br /&gt;pTotalModified = 0;&lt;br /&gt;ptotalRecords = -1;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Boolean getIsTesting()&lt;br /&gt;{&lt;br /&gt;return pIsTesting;&lt;br /&gt;}&lt;br /&gt;public void setIsTesting(Boolean Value)&lt;br /&gt;{&lt;br /&gt;pIsTesting = Value;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public boolean getIsWorking()&lt;br /&gt;{&lt;br /&gt;return pisWorking;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String getTotalRecords()&lt;br /&gt;{&lt;br /&gt;if (ptotalRecords == -1)&lt;br /&gt;{&lt;br /&gt;if (pIsTesting == true)&lt;br /&gt;ptotalRecords = 10000;&lt;br /&gt;else&lt;br /&gt;ptotalRecords = [select count() from Account WHERE (Hierarchy_Status__c = '' OR Hierarchy_Status__c = null) AND (parent_D_B_number__c != null) limit 10000];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if (ptotalRecords == 10000)&lt;br /&gt;return '10,000 or more';&lt;br /&gt;else&lt;br /&gt;return ptotalRecords+ '';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Integer getTotalProcessed()&lt;br /&gt;{&lt;br /&gt;return ptotalProcessed;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Boolean getActionPollerEnabled()&lt;br /&gt;{&lt;br /&gt;return pActionPollerEnabled;&lt;br /&gt;}&lt;br /&gt;public void setActionPollerEnabled(Boolean Value)&lt;br /&gt;{&lt;br /&gt;pActionPollerEnabled = Value;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String getStatusText()&lt;br /&gt;{&lt;br /&gt;return ptotalProcessed + ' Account(s) out of ' + getTotalRecords() + ' are processed.';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public String getButtonCaption()&lt;br /&gt;{&lt;br /&gt;return pbuttonCaption;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Integer getActionPollerInterval()&lt;br /&gt;{&lt;br /&gt;return 10;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public List&lt;account&gt; getInvalidAccounts()&lt;br /&gt;{&lt;br /&gt;return InvalidAccounts;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public Integer getInvalidAccountSize()&lt;br /&gt;{&lt;br /&gt;return InvalidAccounts.size();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public PageReference TaggleActionPoller()&lt;br /&gt;{&lt;br /&gt;if (pActionPollerEnabled)&lt;br /&gt;{&lt;br /&gt;pActionPollerEnabled = false;&lt;br /&gt;pbuttonCaption = 'Start';&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;pActionPollerEnabled = true;&lt;br /&gt;pbuttonCaption = 'Stop';&lt;br /&gt;}&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public PageReference RunBatch()&lt;br /&gt;{&lt;br /&gt;if (pisWorking)&lt;br /&gt;return null;&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;pisWorking = true;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;UpdateAllAccounts();&lt;br /&gt;}&lt;br /&gt;catch(Exception ex)&lt;br /&gt;{&lt;br /&gt;ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.FATAL,ex.getMessage()));&lt;br /&gt;TaggleActionPoller();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//end of the procedure&lt;br /&gt;pisWorking = false;&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public PageReference UpdateAllAccounts()&lt;br /&gt;{&lt;br /&gt;Integer sucessCount = 0;&lt;br /&gt;InvalidAccounts = new List&lt;account&gt;();&lt;br /&gt;List&lt;account&gt; Accounts = [select id, Name, parent_D_B_number__c, ParentId, Hierarchy_Status__c from Account WHERE (Hierarchy_Status__c = '' OR Hierarchy_Status__c = null) AND (parent_D_B_number__c != null) limit 50];&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for(Account a : Accounts)&lt;br /&gt;{&lt;br /&gt;String ParentDBNo = (a.parent_D_B_number__c == null a.parent_D_B_number__c == '')? 'dummy_unknown' : a.parent_D_B_number__c;&lt;br /&gt;&lt;br /&gt;List&lt;account&gt; parents = null;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;parents = [Select id, Name From Account where (D_B_Number__c = :ParentDBNo AND id != :a.id)];&lt;br /&gt;}&lt;br /&gt;catch(Exception e)&lt;br /&gt;{}&lt;br /&gt;&lt;br /&gt;Account parent = null;&lt;br /&gt;if (parents == null parents.size() &lt;= 0) { a.Hierarchy_Status__c = 'Broken Link'; InvalidAccounts.add(a); } else if (Parents.size() &gt; 1)&lt;br /&gt;{&lt;br /&gt;a.Hierarchy_Status__c = 'Duplicated Parent';&lt;br /&gt;InvalidAccounts.add(a);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;parent = parents[0];&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;if (parent != null &amp;amp;&amp;amp; parent.id != a.id)&lt;br /&gt;{&lt;br /&gt;a.ParentId = parent.id;&lt;br /&gt;a.Hierarchy_Status__c = 'Updated';&lt;br /&gt;&lt;br /&gt;sucessCount++;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;update a;&lt;br /&gt;}&lt;br /&gt;catch(Exception ex)&lt;br /&gt;{&lt;br /&gt;a.Hierarchy_Status__c = 'Update Failed';&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;a.ParentId = null;&lt;br /&gt;update a;&lt;br /&gt;}&lt;br /&gt;catch(Exception ex2)&lt;br /&gt;{&lt;br /&gt;//do nothing&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;InvalidAccounts.add(a);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;ptotalProcessed += 1;&lt;br /&gt;}//end for&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;String msg = '';&lt;br /&gt;&lt;br /&gt;if (Accounts.size() == 0)&lt;br /&gt;{&lt;br /&gt;msg = 'All Records are up to date.';&lt;br /&gt;TaggleActionPoller();&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;msg = ' A total of ' + sucessCount + ' Account(s) updated and ' + InvalidAccounts.size() + ' failed to get updated. This list will updated in '+ getActionPollerInterval() + ' seconds.';&lt;br /&gt;}&lt;br /&gt;ApexPages.addMessage(new ApexPages.Message(ApexPages.severity.INFO, msg));&lt;br /&gt;&lt;br /&gt;return null;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public PageReference UpdateAccounts()&lt;br /&gt;{&lt;br /&gt;//updates only invalid ones&lt;br /&gt;updateAccountHierarchy('Updated','');&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public PageReference UpdateAccountsAll() {&lt;br /&gt;//updates all accounts&lt;br /&gt;updateAccountHierarchy('','');&lt;br /&gt;return null;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void updateAccountHierarchy(String Find, String updateTo)&lt;br /&gt;{&lt;br /&gt;if (pIsTesting == true)&lt;br /&gt;{&lt;br /&gt;//do nothing. We are testing!&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;//this code cleans up all accounts Hierarchy_Status__c&lt;br /&gt;for(Account[] accs : [Select id, Hierarchy_Status__c from Account where Hierarchy_Status__c != :Find limit 10000])&lt;br /&gt;{&lt;br /&gt;for(Account a : accs)&lt;br /&gt;{&lt;br /&gt;a.Hierarchy_Status__c = updateTo;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;update accs;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Integer Count = [Select count() from Account where Hierarchy_Status__c != :Find limit 10000];&lt;br /&gt;if (count &gt; 0)&lt;br /&gt;updateAccountHierarchy(Find,updateTo);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public PageReference LaunchReports()&lt;br /&gt;{&lt;br /&gt;PageReference ref = new PageReference('/apex/AccountHierarchyReports');&lt;br /&gt;ref.setRedirect(true);&lt;br /&gt;&lt;br /&gt;return ref;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;The controller also forwards the user to another visualforce page which user will be able to see the report (all invalid accounts). This is something that you can implement easily on you own.&lt;br /&gt;&lt;br /&gt;Now the last touch-ups. Our page iterates through all Accounts and mark them once and for all. Therefore, we will face two problems:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;What if we wanted to re-run the process?&lt;br /&gt;This can be taken care of if you write a method to remove the flags from all or some of the records based on what makes sense to you.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;What if I fixed one of the invalid Accounts, how the can the system know or the flag to be set to OK?&lt;br /&gt;The answer is a Trigger on the Account object.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="OVERFLOW: auto; WIDTH: 98%; HEIGHT: 400px; BACKGROUND-COLOR: rgb(245,245,240)"&gt;&lt;br /&gt;trigger HierarchyStatusReferesh on Account (before update) {&lt;br /&gt;// this trigger removes the previous value of "Hierarchy_Status__c" field&lt;br /&gt;// if the account's parent_duns_number__c or Ultimate_Parent_D_B_Number__c are changed.&lt;br /&gt;// this trigger work in conjunction with Account Hierarchy Builder tool.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Map&lt;id,&gt; entries = new Map&lt;id,&gt;(Trigger.old);&lt;br /&gt;&lt;br /&gt;for(Account newAcc: Trigger.new)&lt;br /&gt;{&lt;br /&gt;Account acc = entries.get(newAcc.id);&lt;br /&gt;if (Acc.parent_D_B_number__c != newAcc.parent_D_B_number__c)&lt;br /&gt;newAcc.Hierarchy_Status__c = '';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;/b:includable&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-4148070125414123020?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UlF2bwDkHlsDb1pYdGZaNWItA-Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UlF2bwDkHlsDb1pYdGZaNWItA-Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/UlF2bwDkHlsDb1pYdGZaNWItA-Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UlF2bwDkHlsDb1pYdGZaNWItA-Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/GR-_nj0DNdA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/4148070125414123020/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/10/how-to-mass-update-all-your-objects.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/4148070125414123020?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/4148070125414123020?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/GR-_nj0DNdA/how-to-mass-update-all-your-objects.html" title="How To Mass Update All Your Object's Data?" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/_A3gbIRtV9H8/SOQ8KkBAsqI/AAAAAAAAAFI/OKv_h6MUz78/s72-c/acconthierarchy.jpg" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/10/how-to-mass-update-all-your-objects.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkABR3Y6fip7ImA9WxRRGUw.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-8695070204491839684</id><published>2008-09-30T14:14:00.006-04:00</published><updated>2008-10-01T23:39:16.816-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-01T23:39:16.816-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>How to Cutomize pageBlockTable Columns On The Fly in Your VF Pages?</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_A3gbIRtV9H8/SOKAVPKPB6I/AAAAAAAAAFA/5LsJjDH0VRA/s1600-h/oppList.jpg"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_A3gbIRtV9H8/SOKAVPKPB6I/AAAAAAAAAFA/5LsJjDH0VRA/s400/oppList.jpg" alt="" id="BLOGGER_PHOTO_ID_5251901217802487714" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;A few days ago I can across a developer's post having difficulty customizing pageBlockTable columns on the fly. The fact is that pageBlockTable component is designed very flexible by nature and is quite powerful component.&lt;br /&gt;&lt;br /&gt;In this article I will demonstrate how you can customize your columns and show to the user what is required to be shown. This is specially useful when creating reports.&lt;br /&gt;&lt;br /&gt;Imagine we have a Visualforce page which views Opportunities' information with following characteristics:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Opportunity Name&lt;/li&gt;&lt;li&gt;Account Name&lt;/li&gt;&lt;li&gt;Opportunity Amount&lt;/li&gt;&lt;li&gt;Fixed Interest Amount (%25 of the Amount)&lt;/li&gt;&lt;li&gt;Opportunity Status (based on Close Date, if it is passed then "Closed" if not then "Open")&lt;/li&gt;&lt;/ul&gt;Let's look at the controller's code first. It is very straight forward, it has only one method:&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 300px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt; &lt;style&gt; st1\:*{behavior:url(#ieooui) } &lt;/style&gt; &lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:blue;"   &gt;public&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; myOppsController&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt; List&lt;&lt;st1:place st="on"&gt;Opportunity&lt;/st1:place&gt;&gt; opportunities;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; List&lt;&lt;st1:place st="on"&gt;Opportunity&lt;/st1:place&gt;&gt; getOpportunities()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;    &lt;/span&gt;opportunities = [Select Name, Amount, Account.Name, CloseDate from &lt;st1:place st="on"&gt;Opportunity&lt;/st1:place&gt;];&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color:blue;"&gt;return&lt;/span&gt; opportunities;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;}&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;getOpportunities() property returns a list of Opportunities.&lt;br /&gt;Note: for the simplicity of the example I did not put any conditions or limit in number of rows that we return. However, if you have more than 1000 Opportunity records then before running this code add some conditions or limits to the query.&lt;br /&gt;&lt;br /&gt;Well, now let's take a moment to see what we need to be able to customize the view of the selected columns.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;br /&gt;&amp;lt;apex:page controller=&amp;quot;myOppsController&amp;quot; tabStyle=&amp;quot;Opportunity&amp;quot;&amp;gt;&lt;br /&gt; &amp;lt;apex:form &amp;gt;&lt;br /&gt;&amp;lt;apex:sectionHeader title=&amp;quot;Opps List&amp;quot; /&amp;gt;&lt;br /&gt;&amp;lt;apex:pageBlock title=&amp;quot;&amp;quot; id=&amp;quot;pageBlock&amp;quot;&amp;gt;&lt;br /&gt;  &amp;lt;apex:pageMessages &amp;gt;&amp;lt;/apex:pageMessages&amp;gt;&lt;br /&gt;  &amp;lt;apex:pageBlockTable value=&amp;quot;{!opportunities}&amp;quot; var=&amp;quot;o&amp;quot; rendered=&amp;quot;{!NOT(ISNULL(opportunities))}&amp;quot;&amp;gt;&lt;br /&gt;    &amp;lt;apex:column value=&amp;quot;{!o.Name}&amp;quot;&amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;    &amp;lt;apex:column value=&amp;quot;{!o.Account.Name}&amp;quot;&amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;    &amp;lt;apex:column value=&amp;quot;{!o.Amount}&amp;quot;&amp;gt;&amp;lt;/apex:column&amp;gt;&lt;br /&gt;    &amp;lt;apex:column &amp;gt;&lt;br /&gt;       &amp;lt;apex:facet name=&amp;quot;header&amp;quot;&amp;gt;Fix Interest&amp;lt;/apex:facet&amp;gt;&lt;br /&gt;       {! o.Amount * 0.25 }     &lt;br /&gt;     &amp;lt;/apex:column&amp;gt;&lt;br /&gt;    &amp;lt;apex:column &amp;gt;&lt;br /&gt;       &amp;lt;apex:facet name=&amp;quot;header&amp;quot;&amp;gt;Status&amp;lt;/apex:facet&amp;gt;&lt;br /&gt;       &amp;lt;div style=&amp;quot;background-color:{!IF(o.CloseDate &amp;gt; TODAY(),'#7CFC00', '#FFA07A')}&amp;quot;&amp;gt;&lt;br /&gt;       {!IF(o.CloseDate &amp;gt; TODAY(),'Open', 'Closed')}  &lt;br /&gt;       &amp;lt;/div&amp;gt;   &lt;br /&gt;    &amp;lt;/apex:column&amp;gt;&lt;br /&gt;    &lt;br /&gt;  &amp;lt;/apex:pageBlockTable&amp;gt;&lt;br /&gt;&amp;lt;/apex:pageBlock&amp;gt;&lt;br /&gt;&amp;lt;/apex:form&amp;gt;&lt;br /&gt;&amp;lt;/apex:page&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;As you can see in the above code by using the putting a template in the body of the apex:Column component you can actually go free style!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-8695070204491839684?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JlGkyvozC_m9mgvFB0tnrTHSg0Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JlGkyvozC_m9mgvFB0tnrTHSg0Y/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/JlGkyvozC_m9mgvFB0tnrTHSg0Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JlGkyvozC_m9mgvFB0tnrTHSg0Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/O_NRjbPsdLE" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/8695070204491839684/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/09/how-to-cutomize-pageblocktable-columns.html#comment-form" title="9 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/8695070204491839684?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/8695070204491839684?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/O_NRjbPsdLE/how-to-cutomize-pageblocktable-columns.html" title="How to Cutomize pageBlockTable Columns On The Fly in Your VF Pages?" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/_A3gbIRtV9H8/SOKAVPKPB6I/AAAAAAAAAFA/5LsJjDH0VRA/s72-c/oppList.jpg" height="72" width="72" /><thr:total>9</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/09/how-to-cutomize-pageblocktable-columns.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkABR3Y6fyp7ImA9WxRRGUw.&quot;"><id>tag:blogger.com,1999:blog-5277328648605741474.post-8679355919750001630</id><published>2008-09-29T16:05:00.003-04:00</published><updated>2008-10-01T23:39:16.817-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-10-01T23:39:16.817-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Visualforce" /><title>Testing Your Controller Extentions</title><content type="html">&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_A3gbIRtV9H8/SOE5-NGTpmI/AAAAAAAAAEw/0kkIaOQzm3o/s1600-h/codecoverage2.jpg"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_A3gbIRtV9H8/SOE5-NGTpmI/AAAAAAAAAEw/0kkIaOQzm3o/s400/codecoverage2.jpg" border="0" alt=""id="BLOGGER_PHOTO_ID_5251542381321496162" /&gt;&lt;/a&gt;&lt;br /&gt;In a previous post I pointed it out how you can get good test coverage when deploying your VF pages. Since then many readers asked me about deploying VF pages with Controller Extensions.&lt;br /&gt;&lt;br /&gt;In concept they are the same and the test is done with the same approach!&lt;br /&gt;&lt;br /&gt;In this article I will show you how similar the Custom Controllers and Controller Extensions are. Very simple but maybe with a little twist!&lt;br /&gt;&lt;br /&gt;Let's imagine that we have a Visualforce Page that extends the standard controller "Contact".&lt;br /&gt;&lt;br /&gt;Here is how the page looks like:&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 100px; background-color: rgb(245, 245, 240);"&gt;&amp;lt;apex:page standardController="Contact" extensions="myControllerExtention"&amp;gt;&lt;br /&gt;&amp;lt;apex:form &amp;gt;&lt;br /&gt;&amp;lt;apex:detail id="contactDetail" /&amp;gt;&lt;br /&gt;&amp;lt;/apex:form&amp;gt;&lt;br /&gt;&amp;lt;/apex:page&amp;gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;Very simple page, so when the page is viewed the URL will be like:&lt;br /&gt;https://cs2.salesforce.com/apex/mypage?id=003200000005LaO&lt;br /&gt;&lt;br /&gt;Where id parameter will be a contact's id and the user will see a page the same as Contact's detail page.&lt;br /&gt;&lt;br /&gt;The controller looks like this:&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;  &lt;div class="Section1"&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; myControllerExtention {&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;private&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Contact&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; con; &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; myControllerExtention(ApexPages.StandardController stdController)&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   {&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;    this.con = (&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Contact&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;)stdController.getRecord();&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   }&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; string GetContactName()&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   {&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;            &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;return&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; con.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Name&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   }  &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;   &lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;}&lt;/span&gt;&lt;/p&gt;  &lt;/div&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;And now is the time we developed the Tester class.&lt;br /&gt;&lt;br /&gt;The tester class should implement a method that creates an instance of the Contact controller and then pass that controller to the Constructor of our Extension class. That's it, the rest is the same as testing Custom controllers.&lt;br /&gt;&lt;br /&gt;&lt;b:includable id="something"&gt;&lt;br /&gt;&lt;div style="overflow: auto; width: 98%; height: 400px; background-color: rgb(245, 245, 240);"&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal  {mso-style-parent:"";  margin:0in;  margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:12.0pt;  font-family:"Times New Roman";  mso-fareast-font-family:"Times New Roman";} @page Section1  {size:8.5in 11.0in;  margin:1.0in 1.25in 1.0in 1.25in;  mso-header-margin:.5in;  mso-footer-margin:.5in;  mso-paper-source:0;} div.Section1  {page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable  {mso-style-name:"Table Normal";  mso-tstyle-rowband-size:0;  mso-tstyle-colband-size:0;  mso-style-noshow:yes;  mso-style-parent:"";  mso-padding-alt:0in 5.4pt 0in 5.4pt;  mso-para-margin:0in;  mso-para-margin-bottom:.0001pt;  mso-pagination:widow-orphan;  font-size:10.0pt;  font-family:"Times New Roman";  mso-ansi-language:#0400;  mso-fareast-language:#0400;  mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;public&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;class&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; testMyPage {&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;static&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; testMethod void myPage_Test()&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;{&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:olive;"   &gt;//Test converage for the myPage visualforce page&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;    &lt;/span&gt;PageReference pageRef = Page.MyPage;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;    &lt;/span&gt;Test.setCurrentPageReference(pageRef);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Account&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; newAccount = &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Account&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; (name=&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:green;"   &gt;'XYZ Organization'&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;insert&lt;/span&gt;&lt;/i&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; newAccount;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:olive;"   &gt;//create first contact&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt; &lt;/span&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Contact&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; myContact = &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; &lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;Contact&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; (FirstName=&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:green;"   &gt;'Joe'&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;,&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;                 &lt;/span&gt;LastName=&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:green;"   &gt;'Schmoe'&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;,&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;                 &lt;/span&gt;AccountId=newAccount.id);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;     &lt;/span&gt;&lt;/span&gt;&lt;i&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;insert&lt;/span&gt;&lt;/i&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; myContact;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;  &lt;/span&gt;ApexPages.StandardController sc = &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; ApexPages.standardController(myContact);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:olive;"   &gt;// create an instance of the controller&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;  &lt;/span&gt;myControllerExtention myPageCon = &lt;/span&gt;&lt;b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;new&lt;/span&gt;&lt;/b&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt; myControllerExtention(sc);&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:olive;"   &gt;//try calling methods/properties of the controller in all possible scenarios&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:olive;"   &gt;// to get the best coverage.&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;  &lt;/span&gt;string ConName = myPageCon.GetContactName();&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;}&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;"  &gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=";font-family:&amp;quot;;font-size:10;color:black;"   &gt;}&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/b:includable&gt;&lt;br /&gt;&lt;br /&gt;Happy coding!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/5277328648605741474-8679355919750001630?l=salesforcesource.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/y7DC94MLlv5GbBeA4alm4pSI13Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/y7DC94MLlv5GbBeA4alm4pSI13Q/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/y7DC94MLlv5GbBeA4alm4pSI13Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/y7DC94MLlv5GbBeA4alm4pSI13Q/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/SalesforceTips/~4/AENR6yHWkOs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://salesforcesource.blogspot.com/feeds/8679355919750001630/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://salesforcesource.blogspot.com/2008/09/testing-your-controller-extentions.html#comment-form" title="7 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/8679355919750001630?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/5277328648605741474/posts/default/8679355919750001630?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/SalesforceTips/~3/AENR6yHWkOs/testing-your-controller-extentions.html" title="Testing Your Controller Extentions" /><author><name>Sam Arjmandi</name><uri>http://www.blogger.com/profile/03304120460251140274</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://2.bp.blogspot.com/_A3gbIRtV9H8/SNkQKgOY6jI/AAAAAAAAABw/lQHFSVsQa_k/S220/sam.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_A3gbIRtV9H8/SOE5-NGTpmI/AAAAAAAAAEw/0kkIaOQzm3o/s72-c/codecoverage2.jpg" height="72" width="72" /><thr:total>7</thr:total><feedburner:origLink>http://salesforcesource.blogspot.com/2008/09/testing-your-controller-extentions.html</feedburner:origLink></entry></feed>

