<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7487142140156375335</id><updated>2026-10-07T00:15:51.658-07:00</updated><category term="Test"/><title type='text'>Salesforce Apex Code Corner</title><subtitle type='html'>Share your SFDC experience !</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>48</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-8447302196121490600</id><published>2013-02-05T02:35:00.000-08:00</published><updated>2013-02-05T02:39:07.852-08:00</updated><title type='text'>Campaign New Button Not Visible In apex salesforce</title><content type='html'>&lt;br /&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;Check you user detail marketing user check box must be&amp;nbsp;clicked.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;Setup -&amp;gt; Personal Setup -&amp;gt; Personal Information -&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;text-align: right;&quot;&gt;Marketing user&lt;/span&gt;&lt;span style=&quot;text-align: right;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;Thanks&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;Vijay&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;text-align: right;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/8447302196121490600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2013/02/campaign-new-button-not-visible-in-apex.html#comment-form' title='356 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/8447302196121490600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/8447302196121490600'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2013/02/campaign-new-button-not-visible-in-apex.html' title='Campaign New Button Not Visible In apex salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>356</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-4280700103350185485</id><published>2012-06-07T00:16:00.003-07:00</published><updated>2012-10-16T02:35:27.899-07:00</updated><title type='text'>Multiple address on Visualforce Page with GMAP in apex salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi guys ,&lt;br /&gt;
&lt;br /&gt;
Look at standard visualforce page for showing multiple address on Gmap.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;lt;apex:page standardController=&quot;Account&quot; sidebar=&quot;false&quot;&amp;gt;
&amp;lt;script src=&quot;http://maps.google.com/maps?file=api&amp;amp;amp;v=2&amp;amp;amp;key=ABQIAAAAzr2EBOXUKnm_jVnk0OJI7xSosDVG8KKPE1-m51RBrvYughuyMxQ-i1QfUnH94QxWIa6N4U6MouMmBA&amp;amp;sensor=false&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var map = null;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var geocoder = null;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function initialize() {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (GBrowserIsCompatible()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map = new GMap2(document.getElementById(&quot;map_canvas&quot;));
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.setCenter(new GLatLng(24.957639, 46.698775), 4);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; geocoder = new GClientGeocoder();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.setUIToDefault();&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function createMarker(point,address)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; { &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Create our &quot;tiny&quot; marker icon
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var blueIcon = new GIcon(G_DEFAULT_ICON);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; blueIcon.image = &quot;http://gmaps-samples.googlecode.com/svn/trunk/markers/green/blank.png&quot;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; blueIcon.iconSize = new GSize(32, 32)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Set up our GMarkerOptions object
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; markerOptions = { icon:blueIcon };
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var marker = new GMarker(point, markerOptions);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GEvent.addListener(marker, &quot;click&quot;, function() {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; marker.openInfoWindowHtml(&quot;&amp;lt;b&amp;gt;&quot;+address+&quot;&amp;lt;/b&amp;gt;&quot;);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return marker;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function showAddress()
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var address1=&#39;{!Account.BillingCity}&#39;+&#39;|&#39;+&#39;{!Account.ShippingCity}&#39;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var address=address1.split(&#39;|&#39;);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(var i=0;i&amp;lt;address.length;i++)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(address[i] == &#39;&#39;){continue;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; var addPart = address[i];
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //alert(&quot;addM(&#39;&quot; + addPart[0] + &quot;&#39;,&#39;&quot; + addPart[1] + &quot;&#39;);&quot;);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; //setTimeout(&quot;addM(&#39;&quot; + addPart + &quot;&#39;);&quot;,300);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; addM(addPart);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; function addM(add)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; add = add + &quot;,India&quot;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (geocoder)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; geocoder.getLatLng(add,function(point)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (!point)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; alert(add + &quot; not found&quot;);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; else
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; map.addOverlay(createMarker(point,add));&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; );&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;lt;/script&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;lt;apex:form &amp;gt; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;div id=&quot;map_canvas&quot; style=&quot;width: 989px; height: 250px&quot;&amp;gt;&amp;lt;/div&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;input type=&quot;button&quot; value = &quot;Show Markers&quot; onClick=&quot;showAddress();&quot;/&amp;gt; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;lt;/apex:form&amp;gt;
&amp;nbsp; &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; initialize();
&amp;nbsp; &amp;lt;/script&amp;gt; &amp;nbsp; &amp;nbsp; 
&amp;lt;/apex:page&amp;gt;

&lt;/pre&gt;
Lets say your page name is multipleAddress
your url looks like  /apex/multipleAddress?id=accountId
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/4280700103350185485/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/06/multiple-address-on-visualforce-page.html#comment-form' title='56 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/4280700103350185485'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/4280700103350185485'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/06/multiple-address-on-visualforce-page.html' title='Multiple address on Visualforce Page with GMAP in apex salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>56</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-1061236895653630812</id><published>2012-05-29T04:45:00.000-07:00</published><updated>2012-10-16T02:36:49.627-07:00</updated><title type='text'>Calculate Hour Minute In Apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi ,&lt;br /&gt;
&lt;br /&gt;
As I had gone to search that how to separate hour and&amp;nbsp;minute in apex , I was trying to search any method which could be return after decimal value so that I could calculate all values after decimal place as total number of minute and then extract the hour from total number of minute&amp;nbsp;divide by 60 and&amp;nbsp;separate again hour and minute !&lt;br /&gt;
&lt;br /&gt;
Then I wrote some logic which is explained below !&lt;br /&gt;
&lt;br /&gt;
We have a class contains two methods&amp;nbsp;returnCheckDecimalValueForMin(string val) and&amp;nbsp;returnCheckDecimalValueForHour(string hour) .&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public class className {&lt;/pre&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public string returnCheckDecimalValueForMin(string dayVal){ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string[] ss = new string[]{};
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(dayVal !=&#39;&#39; &amp;amp;&amp;amp; dayVal!=null){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(dayVal.contains(&#39;.&#39;)){&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string sss = dayVal.replace(&#39;.&#39;,&#39;,&#39;);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ss = sss.split(&#39;,&#39;);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return ss[1] ; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return dayVal ;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(ss.size()&amp;gt;0){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return ss[1];
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else {return &#39;&#39;;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else { return &#39;&#39;;} &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string returnCheckDecimalValueForHour(string dayVal){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string[] ss = new string[]{};
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(dayVal !=&#39;&#39; &amp;amp;&amp;amp; dayVal!=null){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(dayVal.contains(&#39;.&#39;)){&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string sss = dayVal.replace(&#39;.&#39;,&#39;,&#39;);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ss = sss.split(&#39;,&#39;);&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return ss[0] ; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;  &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else {&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return dayVal ;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }else { return &#39;&#39;;} &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
}&lt;/pre&gt;
&lt;br /&gt;
Now let say we have a list of decimal values like 34.46 , 34.56 , 45.57&lt;br /&gt;
&lt;br /&gt;
so what we need to do&amp;nbsp;actually to&amp;nbsp;separate&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;34+34+45 = &amp;nbsp; 113

46+56+67 = &amp;nbsp;169

integer i = math.mod(169,60);

integer returnHr = 169/60 ;

Integer TotalHours = 113 +&amp;nbsp;returnHr.intvalue();

Integer remainingMinutes = 169 - 60*returnHr.intvalue()&amp;nbsp;;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/1061236895653630812/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/05/calculate-hour-min-in-apex-salesforce.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/1061236895653630812'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/1061236895653630812'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/05/calculate-hour-min-in-apex-salesforce.html' title='Calculate Hour Minute In Apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-7813731697164485483</id><published>2012-05-25T21:11:00.001-07:00</published><updated>2012-06-08T05:14:30.814-07:00</updated><title type='text'>User Photo Not Visible On Force.com Site From Rest API In Apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Hi All ,&lt;br /&gt;
I was accessing the photourl through force.com site !&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&quot;photo&quot;: {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;largePhotoUrl&quot;: &quot;https://instance_name/profilephoto/729D00000000BDV/F&quot;,
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;photoVersionId&quot;: &quot;729D00000000BDV&quot;,
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &quot;smallPhotoUrl&quot;: &quot;https://instance_name/profilephoto/729D00000000BDV/T&quot;
},&lt;/pre&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&lt;/pre&gt;
Now if we expose these photo url on visualforce page would render properly but if we try to get the same of public force.com site these photo url does not exist because session does not maintain .Images look like burst and does not show properly.

So what we can do , we can append either oauth_token or sessionid at the last of the photourl as a parameter. 
Let say our photo url is &quot;largePhotoUrl&quot;:&amp;nbsp;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&quot;https://instance_name/profilephoto/729D00000000BDV/F&quot;,&lt;/pre&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&lt;/pre&gt;
so we need to append the oauth_token like :

&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;largePhotoUrl&quot;: &quot;https://instance_name/profilephoto/729D00000000BDV/F&#39;?oauth_token=00DV0000004RJpB!ARMAQFwrXxu7t6DAjWcseeWxXTo9UtSh4xZbrWJqHRnCulQ16yKqq97wIWIREdPtKfQ7BcFffyD9Y43MVBfa4hmHaPLfkT6C&#39;;&lt;/pre&gt;
Now you can access the image as public with the help of oauth_token .

Thanks
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;span style=&quot;font-size: 12px; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/7813731697164485483/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/05/user-photo-not-visible-on-forcecom-site.html#comment-form' title='64 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7813731697164485483'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7813731697164485483'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/05/user-photo-not-visible-on-forcecom-site.html' title='User Photo Not Visible On Force.com Site From Rest API In Apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>64</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-8869981175494453288</id><published>2012-05-23T23:15:00.001-07:00</published><updated>2012-05-24T06:12:08.774-07:00</updated><title type='text'>Product And Campaign Tab Not Visible For Partner Portal Tab  In apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi ,&lt;br /&gt;
Very first think you need to check that Customize Portal Tab for partner portal if any of the tab is not available in the left or right drop down then its mean those tabs are not&amp;nbsp;available for portal user .&lt;br /&gt;
&lt;br /&gt;
We have&amp;nbsp;alternate&amp;nbsp;option to do the same that we can create a simple VF page with the standard controller of that particular object and redirected page url to the url comes when&amp;nbsp;clicking&amp;nbsp;on product or Campaign Tab generally .&lt;br /&gt;
&lt;br /&gt;
Below is example for product tab :&lt;br /&gt;
&lt;br /&gt;
VF Page :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;lt;apex:page standardController=&quot;Product2&quot; extensions=&quot;ProductTabCls&quot; action=&quot;{!ProductRrl}&quot;&amp;gt;


&amp;lt;/apex:page&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
Class Code :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public class ProductTabCls {

&amp;nbsp; &amp;nbsp; public ProductTabCls(ApexPages.StandardController controller) {

&amp;nbsp; &amp;nbsp; }&amp;nbsp; &amp;nbsp;

&amp;nbsp; &amp;nbsp; public pagereference ProductRrl(){

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pagereference page = new pagereference(&#39;/01t/o&#39;);

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; page.setRedirect(true);

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return page;

&amp;nbsp; &amp;nbsp; }&amp;nbsp; &amp;nbsp;

}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Now Create a Visualforce Tab by selecting the newly created VF page !&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/8869981175494453288/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/05/product-and-campaign-tab-not-visible.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/8869981175494453288'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/8869981175494453288'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/05/product-and-campaign-tab-not-visible.html' title='Product And Campaign Tab Not Visible For Partner Portal Tab  In apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-4799023050559626040</id><published>2012-05-23T23:04:00.000-07:00</published><updated>2012-05-23T23:15:23.470-07:00</updated><title type='text'>Campaign Tab New Button Not Visible For Some Users In Apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi All ,&lt;br /&gt;
&lt;br /&gt;
Campaign is only&amp;nbsp;available&amp;nbsp;for marketing users . If you have marketing user licence you can enable to User to create a campaign .&lt;br /&gt;
You just need to checked Marketing User Check box on User Personal Information .&lt;br /&gt;
&amp;nbsp;Setup-&amp;gt; &amp;nbsp;My Personal Information - &amp;gt; Personal Information --&amp;gt; Edit&lt;br /&gt;
&amp;nbsp;Checked&amp;nbsp;Marketing User Check box&amp;nbsp; click save !&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/4799023050559626040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/05/campaign-tab-new-button-not-visible-for.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/4799023050559626040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/4799023050559626040'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/05/campaign-tab-new-button-not-visible-for.html' title='Campaign Tab New Button Not Visible For Some Users In Apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-6585327142785206424</id><published>2012-03-29T23:19:00.003-07:00</published><updated>2012-04-07T20:33:51.111-07:00</updated><title type='text'>Export Excel if(!window.sfdcPage){ window.sfdcPage = new ApexPage(); }  Issue with MAC in apex visualforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi guys ,&lt;br /&gt;
I faced a big issue with MAC if I am exporting .xls file through visualforce page.&lt;br /&gt;
The problem arise only in case if we are using PageBlock and PageBlock Table . I just replaced pageBlockTable with simple datatable and problem resolved.&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/6585327142785206424/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/export-excel-ifwindowsfdcpage.html#comment-form' title='22 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/6585327142785206424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/6585327142785206424'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/export-excel-ifwindowsfdcpage.html' title='Export Excel if(!window.sfdcPage){ window.sfdcPage = new ApexPage(); }  Issue with MAC in apex visualforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>22</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-225930228505731880</id><published>2012-03-23T03:59:00.000-07:00</published><updated>2012-03-26T04:19:16.958-07:00</updated><title type='text'>visualforce dynamicComponent in apex salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi all ,&lt;br /&gt;
This post is regarding the Visualforce Tag &amp;lt;apex:dynamicComponent&amp;gt; which is very useful feature in Visuaforce developement.&lt;br /&gt;
Hava a look on this.&lt;br /&gt;
&lt;br /&gt;
This tag acts as a placeholder for your dynamic Apex components. It has one required parameter componentValue which accepts the name of an Apex method that returns a dynamic component.&lt;br /&gt;
&lt;br /&gt;
Page:&lt;br /&gt;
====

&lt;pre class=&quot;brush: java&quot;&gt;
&amp;lt;apex:page standardController=&quot;Contact&quot; extensions=&quot;dynamicSample&quot;&amp;gt;
&amp;nbsp; &amp;nbsp;&amp;lt;apex:dynamicComponent componentValue=&quot;{!headerWithDueDateCheck}&quot;/&amp;gt;
&amp;nbsp; &amp;nbsp;&amp;lt;apex:form &amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:inputField value=&quot;{!Contact.LastName}&quot;/&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:commandButton value=&quot;Save&quot; action=&quot;{!save}&quot;/&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/apex:form&amp;gt;
&amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:pageBlock title=&quot;This is dynamic Page Block Table&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;!--&amp;lt;apex:pageBlockTable &amp;gt;&amp;lt;/apex:pageBlockTable&amp;gt;--&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:dynamicComponent componentValue=&quot;{!PageBlockDate}&quot;/&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/apex:pageBlock&amp;gt;
&amp;nbsp;
&amp;lt;/apex:page&amp;gt;

&lt;/pre&gt;
Class Code:
========

&lt;pre class=&quot;brush: java&quot;&gt;
public class dynamicSample {

&amp;nbsp; &amp;nbsp; public dynamicSample(ApexPages.StandardController controller) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Component.Apex.PageBlockTable getPageBlockDate(){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&amp;lt;Contact&amp;gt; lstContact = [select id,Name,FirstName,LastName from Contact];
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Component.Apex.PageBlockTable pbTable = new Component.Apex.PageBlockTable();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pbTable.value = lstContact ;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pbTable.var = &#39;x&#39;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pbTable.columns =3;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pbTable.border= &#39;10&#39; ; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Component.Apex.Column firstNameCol = new Component.Apex.Column();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firstNameCol.expressions.value = &#39;{!x.FirstName}&#39;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Component.Apex.Column firstNameCol1 = new Component.Apex.Column();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; firstNameCol1.expressions.value = &#39;{!x.Id}&#39;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pbTable.childComponents.add(firstNameCol);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; pbTable.childComponents.add(firstNameCol1);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return pbTable;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public Component.Apex.SectionHeader getHeaderWithDueDateCheck() {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; date dueDate = date.newInstance(2011, 7, 4);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; boolean overdue = date.today().daysBetween(dueDate) &amp;lt; 0;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Component.Apex.SectionHeader sectionHeader = new Component.Apex.SectionHeader();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (overdue) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sectionHeader.title = &#39;This Form Was Due On &#39; + dueDate.format() + &#39;!&#39;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return sectionHeader;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; sectionHeader.title = &#39;Form Submission&#39;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return sectionHeader;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; }
}
&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/225930228505731880/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/visualforce-dynamiccomponent-in-apex.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/225930228505731880'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/225930228505731880'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/visualforce-dynamiccomponent-in-apex.html' title='visualforce dynamicComponent in apex salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-418440931429378123</id><published>2012-03-20T21:27:00.001-07:00</published><updated>2012-04-14T10:31:54.507-07:00</updated><title type='text'>Record type for creating test class data in Apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;display: block; height: auto; width: inherit;&quot;&gt;
Hello guys ,&lt;br /&gt;
We have some important&amp;nbsp;consideration&amp;nbsp;while creating test data in our test classes.&lt;br /&gt;
So let say if we need to create a record based on the record type id , what we do normally , we query on record type object based on SobjectType and the record type Name.&lt;br /&gt;
for example :&lt;br /&gt;
let say we have a Account Record Types A &amp;amp; B
Not if we need to create a Account Record with record type A or B .
We normally query like this .
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;RecordType rt = [select id,Name from RecordType where SobjectType=&#39;Account&#39; and Name=&#39;A&#39; Limit 1];&lt;/pre&gt;
And now use this value further while creating the Account Record.&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
Account acc = new Account(Name=&#39;Test&#39; , recordTypeId=rt.id);
&lt;/pre&gt;&lt;br /&gt;

To avoid this query in test class we can the same in some other manner .

&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;Schema.DescribeSObjectResult&amp;nbsp;cfrSchema&amp;nbsp;=&amp;nbsp;Schema.SObjectType.Account;&amp;nbsp;&lt;br/&gt;Map&amp;lt;String,Schema.RecordTypeInfo&amp;gt;&amp;nbsp;AccountRecordTypeInfo&amp;nbsp;=&amp;nbsp;cfrSchema.getRecordTypeInfosByName(); 
&lt;/pre&gt;
Now to get the recordTypeId we will have to use a method&amp;nbsp;getRecordTypeId.

&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;Id rtId&amp;nbsp;=&amp;nbsp;AccountRecordTypeInfo&amp;nbsp;.get(&#39;A&#39;).getRecordTypeId(),
&lt;/pre&gt;
Now Use can insert Account Record like
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;Account Acc = new Account(Name=&#39;test&#39;,recordtypeid=AccountRecordTypeInfo&amp;nbsp;.get(&#39;A&#39;).getRecordTypeId());
insert Acc;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks

&lt;span id=&quot;ApexClassViewPage:theTemplate:theForm:thePageBlock:j_id56:j_id57:j_id58&quot;&gt;&lt;/span&gt;
&lt;br /&gt;
&lt;pre class=&quot;codeBlock&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/418440931429378123/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/record-type-for-crating-test-class-data.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/418440931429378123'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/418440931429378123'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/record-type-for-crating-test-class-data.html' title='Record type for creating test class data in Apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-893399741617728958</id><published>2012-03-19T04:09:00.001-07:00</published><updated>2012-03-26T06:13:10.801-07:00</updated><title type='text'>actionRegion VF Tag in Apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi Guys ,&lt;br /&gt;
I had a deep look on this&amp;nbsp;actionRegion component posted by&amp;nbsp;&lt;a href=&quot;https://plus.google.com/117729771558116862589&quot; rel=&quot;author&quot; style=&quot;background-color: white; color: #6fa8dc; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 12px; line-height: 16px; text-align: -webkit-auto; text-decoration: none;&quot; target=&quot;_new&quot;&gt;Abhinav Gupta&lt;/a&gt;&amp;nbsp;.&lt;br /&gt;
That is best example to understand !&lt;br /&gt;
Look at the url given below&lt;br /&gt;
Thanks to&amp;nbsp;
&lt;a href=&quot;https://plus.google.com/117729771558116862589&quot; rel=&quot;author&quot; style=&quot;background-color: white; color: #6fa8dc; font-family: &#39;Lucida Grande&#39;, &#39;Lucida Sans Unicode&#39;, Helvetica, Arial, Verdana, sans-serif; font-size: 12px; line-height: 16px; text-align: -webkit-auto; text-decoration: none;&quot; target=&quot;_new&quot;&gt;Abhinav&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;

&lt;a href=&quot;http://www.tgerm.com/2010/09/visualforce-actionregion-deep-dive.html&quot;&gt;&lt;pre class=&quot;brush: java&quot;&gt;http://www.tgerm.com/2010/09/visualforce-actionregion-deep-dive.html&lt;/pre&gt;&lt;/a&gt;&amp;nbsp;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/893399741617728958/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/actionregion-vf-tag-in-apex-salesforce.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/893399741617728958'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/893399741617728958'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/actionregion-vf-tag-in-apex-salesforce.html' title='actionRegion VF Tag in Apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-7916794348465541511</id><published>2012-03-13T00:08:00.001-07:00</published><updated>2012-03-29T23:24:48.488-07:00</updated><title type='text'>Export Data in CSV or Excel In Apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello guys ,&lt;br /&gt;
This articles lets you know how to export data in csv or excel.&lt;br /&gt;
&lt;br /&gt;
See Example Below .&lt;br /&gt;
Copy paste code according to your data structure.&lt;br /&gt;
&lt;br /&gt;
For Excel :&lt;br /&gt;
&lt;b&gt;Note :&lt;/b&gt; Make sure if you are on MAC then do not use pageBlock and pageBlockTable other wise you get an issue with extra content on visualforce page like&amp;nbsp;if(!window.sfdcPage){ window.sfdcPage = new ApexPage(); }&lt;br /&gt;
So to avoid this issue just use DataTable instead of pageBlock and PageBlockTable.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;lt;apex:page controller=&quot;exportExcel&quot; action=&quot;{!exportToExcel}&quot; readOnly=&quot;true&quot; contentType=&quot;application/vnd.ms-excel#ConsignmentSearchData.xls&quot;&amp;gt;

&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;lt;apex:pageBlock &amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:pageBlockTable value=&quot;{!lstwrapper}&quot; var=&quot;x&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;shipTo&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.shipTo}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;searchNumber&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.searchNumber}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;accountName&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.accountName}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;businessUnit&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.businessUnit}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;dateval&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.dateval}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:column headerValue=&quot;expirationDate&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.expirationDate}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;expirationEndDate&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.expirationEndDate}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:column headerValue=&quot;expirationStartDate&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.expirationStartDate}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;groupval&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.groupval}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;implantDate &quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{!x.implantDate}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;invoiceDate&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.invoiceDate}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column headerValue=&quot;invoiceNumber&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!x.invoiceNumber}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:pageBlockTable&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/apex:pageBlock&amp;gt; &amp;nbsp; 

&amp;lt;/apex:page&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
For CSV :&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;lt;apex:page controller=&quot;exportExcel&quot; action=&quot;{!exportToExcel}&quot; readOnly=&quot;true&quot; contentType=&quot;application/vnd.ms-excel#ConsignmentSearchData.csv&quot;&amp;gt;{!header}
&amp;nbsp; &amp;lt;apex:repeat value=&quot;{!lstwrapper}&quot; var=&quot;x&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{!x.shipTo},{!x.searchNumber},{!x.accountName},{!x.businessUnit},{!x.dateval},{!x.expirationDate},{!x.expirationEndDate},{!x.expirationStartDate},{!x.groupval},{!x.implantDate},{!x.invoiceDate},{!x.invoiceNumber}
&amp;nbsp; &amp;lt;/apex:repeat&amp;gt;
&amp;lt;/apex:page&amp;gt;
&lt;/pre&gt;
Class Code :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public class exportExcel {
&amp;nbsp; 
&amp;nbsp; &amp;nbsp; public string header{get;set;}
&amp;nbsp; &amp;nbsp; public List&amp;lt;wrapper&amp;gt; lstwrapper {get; set;}
&amp;nbsp; &amp;nbsp; public class wrapper{
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string shipTo {get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string searchNumber{get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string accountName{get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string businessUnit{get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string dateval{get; set;}


&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string expirationDate{get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string expirationEndDate{get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string expirationStartDate{get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string groupval{get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string implantDate {get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string invoiceDate{get; set;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public string invoiceNumber{get; set;} &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; &amp;nbsp; public string Filetype{get;set;}
&amp;nbsp; &amp;nbsp; public boolean isExcel {get;set;}
&amp;nbsp; &amp;nbsp; public boolean isCsv {get;set;} &amp;nbsp; 
&amp;nbsp; 




&amp;nbsp; &amp;nbsp; public exportExcel(){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Filetype = &#39;&#39;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lstwrapper = new List&amp;lt;wrapper&amp;gt;();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; header = &#39;Ship To,Search Number,Account Name,Business Unit,Date,Expiration Date,Expiration End Date,Expiration Start Date,Group,Implant Date ,Invoice Date,Invoice Number\r\n&#39;; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; }

&amp;nbsp; 
&amp;nbsp; &amp;nbsp; public void exportToExcel(){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string queryString = &#39;Select c.Account_Name__c, c.Business_Unit__c, c.Date__c, c.Expiration_Date__c,c.Expiration_End_Date__c, c.Expiration_Start_Date__c, c.Group__c, c.Id, c.Implant_Date__c, c.Invoice_Date__c, c.Invoice_Number__c, c.Location__c, c.Name, c.Order_Number__c, c.OwnerId, c.Physician_ID__c, c.PO_Number__c, c.Product_Group__c, c.Product_ID__c, c.Search_ID__c, c.Serial_Number__c, c.Ship_To__c, c.Type__c, c.User_ID__c, c.User_Name__c from Consignment_Search_Data__c c where User_ID__c=\&#39;&#39;+UserInfo.getUserId()+&#39;\&#39;&#39;; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; List&amp;lt;Consignment_Search_Data__c&amp;gt; lstConsignmentSearchData = DataBase.Query(queryString);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; system.debug(&#39;lstConsignmentSearchData :&#39;+lstConsignmentSearchData.size());
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(lstConsignmentSearchData.size()&amp;gt;0){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(Consignment_Search_Data__c csd :lstConsignmentSearchData){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; wrapper w = new wrapper();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.shipTo = csd.Ship_To__c ;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.searchNumber = csd.Search_ID__c;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.accountName = csd.Account_Name__c;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.businessUnit = csd.Business_Unit__c ;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.dateval = string.valueof(csd.Date__c);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.expirationDate = string.valueOf(csd.Expiration_Date__c);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.expirationEndDate = string.valueOf(csd.Expiration_End_Date__c);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.expirationStartDate = string.valueOf(csd.Expiration_Start_Date__c);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.groupval = csd.Group__c;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.implantDate = string.valueOf(csd.Implant_Date__c);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.invoiceDate = string.valueOf(csd.Invoice_Date__c) ;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; w.invoiceNumber = string.valueOf(csd.Invoice_Number__c);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; lstwrapper.add(w); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; system.debug(&#39;lstwrapper :&#39;+lstwrapper.size());
&amp;nbsp; &amp;nbsp; }

&amp;nbsp; 

}


&lt;/pre&gt;
Note : Using the same class code for both page :
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/7916794348465541511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/export-in-csv-and-excel-in-apex.html#comment-form' title='16 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7916794348465541511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7916794348465541511'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/03/export-in-csv-and-excel-in-apex.html' title='Export Data in CSV or Excel In Apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>16</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-7744279707672038860</id><published>2012-02-16T03:32:00.000-08:00</published><updated>2012-03-26T04:37:04.617-07:00</updated><title type='text'>Remove Attachment Button From Attachment Related List in salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi Guys ,&lt;br /&gt;
We can remove attach button from Notes And Attachment Related List from any object by creating a visualforce page.&lt;br /&gt;
Create a visualforce page&amp;nbsp;RemoveAttachBTN&amp;nbsp;with object standard controller .&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
&amp;lt;apex:page standardController=&quot;Account&quot;&amp;gt; &amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;
&amp;lt;apex:relatedList list=&quot;NotesAndAttachments&quot;&amp;gt;
&amp;nbsp; &amp;lt;apex:facet name=&quot;header&quot;&amp;gt;&amp;amp;nbsp;&amp;lt;/apex:facet&amp;gt; &amp;nbsp; &amp;nbsp;&amp;lt;!--This line of code removing the attachment header--&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp;&amp;lt;/apex:relatedList&amp;gt;
&amp;lt;/apex:page&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
https://ap1.visual.force.com/apex/RemoveAttachBTN?id=RecordIdofStandardController&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
Now go to the Edit Layout &amp;nbsp;of the record and add this visualforce page by creating any section , the only drawback is that this section would be between Standard Button of page layout . We can put visualforce just like related list of record.&lt;br /&gt;
&lt;br /&gt;

&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/7744279707672038860/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/02/remove-attachment-button-from.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7744279707672038860'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7744279707672038860'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2012/02/remove-attachment-button-from.html' title='Remove Attachment Button From Attachment Related List in salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-6611160315339490357</id><published>2011-11-30T23:46:00.001-08:00</published><updated>2012-03-26T04:28:09.699-07:00</updated><title type='text'>Dynamic Visualforce Page In Apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi Guys ,&lt;br /&gt;
We can create Visualforce Pages dynamically . Just need to write the script in Apex Class and avoiding on Visualforce Page.&lt;br /&gt;
&lt;br /&gt;
Here I am just creating a &amp;nbsp;list of string with the Account Object Fields with their API name and passing this on Visualforce page .&lt;br /&gt;
&lt;br /&gt;
Controller :
=======
&lt;pre class=&quot;brush: java&quot;&gt;
public class DynamicPage{

&amp;nbsp; &amp;nbsp; public&amp;nbsp;DynamicPage(ApexPages.StandardController controller) {
&amp;nbsp; 
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; 
&amp;nbsp; &amp;nbsp; public Account acc {get;set;}
&amp;nbsp; &amp;nbsp; public List&amp;lt;String&amp;gt; threeFieldList {
&amp;nbsp; &amp;nbsp; get {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (threeFieldList == null) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; threeFieldList = new List&amp;lt;String&amp;gt;();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; threeFieldList.add(&#39;Industry&#39;);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; threeFieldList.add(&#39;AnnualRevenue&#39;);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; threeFieldList.add(&#39;BillingCity&#39;)
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return threeFieldList;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; private set;
&amp;nbsp; &amp;nbsp; }
&amp;nbsp;}
&lt;/pre&gt;
Page Code :
=======
&lt;pre class=&quot;brush: java&quot;&gt;
&amp;lt;apex:page standardController=&quot;Account&quot; extensions=&quot;DynamicPage&quot;&amp;gt;

&amp;lt;apex:form &amp;gt;
&amp;nbsp; &amp;nbsp; &amp;lt;apex:pageBlock title=&quot;Binding Input Field Dynamically&quot; mode=&quot;edit&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:pageBlockSection columns=&quot;1&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:inputField value=&quot;{!Account.Name}&quot; /&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:repeat value=&quot;{!threeFieldList}&quot; var=&quot;afield&quot; &amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:inputField value=&quot;{!acc[afield]}&quot; /&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:repeat&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:pageBlockSection&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/apex:pageBlock&amp;gt;
&amp;lt;/apex:form&amp;gt;

&amp;lt;/apex:page&amp;gt;

&lt;/pre&gt;
So when we need to add another field just need to add that field API Name in&amp;nbsp;threeFieldList which passing in&amp;nbsp;&amp;nbsp;repeater.

&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/6611160315339490357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/11/dynamic-visualforce-page-in-apex.html#comment-form' title='10 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/6611160315339490357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/6611160315339490357'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/11/dynamic-visualforce-page-in-apex.html' title='Dynamic Visualforce Page In Apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>10</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-5687803149685619521</id><published>2011-11-14T23:06:00.001-08:00</published><updated>2012-03-26T06:16:37.340-07:00</updated><title type='text'>Read XML AND Insert Data In to Salesforce using apex Code</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hi guys ,&lt;br /&gt;
Below is the sample code which let you know how to insert data in Salesforce using XML File.&lt;br /&gt;
I am just trying to insert Lead Records in SF.
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public class XmlStreamReaderDemo {
&amp;nbsp; &amp;nbsp; public class Book {
&amp;nbsp; &amp;nbsp; &amp;nbsp;String name;
&amp;nbsp; &amp;nbsp; &amp;nbsp;String author;
&amp;nbsp; &amp;nbsp;}
public List&amp;lt;Book&amp;gt; listRecords = new List&amp;lt;Book&amp;gt;();
&amp;nbsp; 
&amp;nbsp;public &amp;nbsp;Book[] parseBooks(XmlStreamReader reader) {
&amp;nbsp; &amp;nbsp; &amp;nbsp;Book[] books = new Book[0]; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp;while(reader.hasNext()) { 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // &amp;nbsp;Start at the beginning of the book and make sure that it is a book &amp;nbsp;&amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (reader.getEventType() == XmlTag.START_ELEMENT) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (&#39;Book&#39; == reader.getLocalName()) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Book book = parseBook(reader); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// &amp;nbsp;Pass the book to the parseBook method (below) &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; books.add(book);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; reader.next();
&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&amp;nbsp; &amp;nbsp; return books;
&amp;nbsp; &amp;nbsp;}

&amp;nbsp; 

&amp;nbsp; &amp;nbsp;public Book parseBook(XmlStreamReader reader) {
&amp;nbsp; &amp;nbsp; Book book = new Book();
&amp;nbsp; &amp;nbsp; &amp;nbsp;book.author = reader.getAttributeValue(null, &#39;author&#39;);
&amp;nbsp; &amp;nbsp; &amp;nbsp;while(reader.hasNext()) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (reader.getEventType() == XmlTag.END_ELEMENT) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;break;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } else if (reader.getEventType() == XmlTag.CHARACTERS) {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;//book.name = reader.getText();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;book.name = getDecodedString(reader);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; reader.next();
&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&amp;nbsp; &amp;nbsp; &amp;nbsp;return book;
&amp;nbsp; &amp;nbsp;}

&amp;nbsp; 
&amp;nbsp; &amp;nbsp;public XmlStreamReaderDemo(string data){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; XmlStreamReader xsr = new XmlStreamReader(data);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; listRecords = parseBooks(xsr);
&amp;nbsp; &amp;nbsp; }
&amp;nbsp;&amp;nbsp; 
&amp;nbsp; &amp;nbsp; public void testBookParser() {
&amp;nbsp; &amp;nbsp; &amp;nbsp;String str = &#39;&amp;lt;books&amp;gt;&amp;lt;book author=&quot;Chatty&quot;&amp;gt;Foo bar&amp;lt;/book&amp;gt;&#39; +
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &#39;&amp;lt;book author=&quot;Sassy&quot;&amp;gt;Baz&amp;lt;/book&amp;gt;&amp;lt;/books&amp;gt;&#39;;
&amp;nbsp; &amp;nbsp; &amp;nbsp;XmlStreamReaderDemo callxml1 = new XmlStreamReaderDemo(str);
&amp;nbsp; &amp;nbsp; &amp;nbsp;system.debug(&#39;callxml1 callxml1 :&#39;+callxml1);
&amp;nbsp; &amp;nbsp; &amp;nbsp;List&amp;lt;Lead&amp;gt; leadtoInsert = new List&amp;lt;Lead&amp;gt;();
&amp;nbsp; &amp;nbsp; &amp;nbsp;for(XmlStreamReaderDemo.Book b : callxml1.listRecords) { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Lead Ld = new Lead();
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ld.Company = &#39;x&#39;;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ld.LastName = b.name;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;leadtoInsert.add(ld); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; system.debug(&#39;*********** ::: &#39;+leadtoInsert.size());
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; system.debug(&#39;*********** ::: &#39;+leadtoInsert);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(leadtoInsert.size() &amp;gt;0){
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;insert leadtoInsert;
&amp;nbsp; &amp;nbsp;}
&amp;nbsp; &amp;nbsp;}
&amp;nbsp; 
&amp;nbsp; &amp;nbsp; &amp;nbsp;String getDecodedString(Xmlstreamreader reader)
&amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return EncodingUtil.urlDecode(reader.getText(), &#39;UTF-8&#39;).trim();
&amp;nbsp; &amp;nbsp; &amp;nbsp; }
}
&lt;/pre&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&lt;/pre&gt;
&lt;pre class=&quot;brush: java&quot;&gt;Use Anonymous Block to execute this code :

XmlStreamReaderDemo  obj = new XmlStreamReaderDemo ( &#39;&amp;lt;books&amp;gt;&amp;lt;book author=&quot;Chatty&quot;&amp;gt;Foo bar&amp;lt;/book&amp;gt;&#39; +
        &#39;&amp;lt;book author=&quot;Sassy&quot;&amp;gt;Baz&amp;lt;/book&amp;gt;&amp;lt;/books&amp;gt;&#39;);
obj.testBookParser();
&lt;/pre&gt;
&lt;div&gt;
&lt;div&gt;
&lt;br /&gt;
Now you will see two Lead records have been inserted.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Thanks&lt;/div&gt;
&lt;div&gt;
vijay&lt;/div&gt;
&lt;/div&gt;
&lt;div style=&quot;font-size: 12px; white-space: pre;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: Arial, Helvetica, sans-serif;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/5687803149685619521/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/11/read-xml-and-insert-data-in-to.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/5687803149685619521'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/5687803149685619521'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/11/read-xml-and-insert-data-in-to.html' title='Read XML AND Insert Data In to Salesforce using apex Code'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-2389777552983630471</id><published>2011-10-14T06:49:00.000-07:00</published><updated>2012-03-26T04:39:22.114-07:00</updated><title type='text'>Login in salesforce through .Net Application</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
1. Download Partner or Enterprice wsdl file from saleforce&lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
Setup - &amp;gt; Develope - &amp;gt; API - &amp;gt; Right Click on Generate Partner WSDL -&amp;gt; &amp;nbsp;Save link As -&amp;gt; Post Fix .wsdl in the file Name&lt;br /&gt;
&lt;br /&gt;
2. Put this wsdl file on a specified location . Lets say I am putting this file in My &amp;nbsp;D:\ProjectFolder&lt;br /&gt;
&lt;br /&gt;
3. Now Create a window form application.&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Click on File - &amp;gt; New -&amp;gt; Project - &amp;gt; Visual C# -&amp;gt; Windows Forms Application&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Name of your Project&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Location of your application&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Now click on OK Button.&lt;br /&gt;
4. Go to solution Explorer&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Right Click on Project Name -&amp;gt; Click on Add Web Refernce -&amp;gt; If Add web Reference Not Visible then Click On Add Service &lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Reference - &amp;gt; Click On Advance - &amp;gt; Click on Add web Reference -&amp;gt; Put The location where you had your wsdl file.&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;D:\ProjectFolder is my wsdl location Now include your wsdl file Name&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;D:\ProjectFolder\FileName.wsdl&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Click on Go Button &amp;nbsp;- &amp;gt; Give the Web Reference Name - &amp;gt; Click On Add Reference Button&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;Now you have successfully added web service in your .net Application.&lt;br /&gt;
5. Now Double Click on Desing Form&lt;br /&gt;
6.Now put this code inside the method :&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;private void method Form_Load(object sender , eventArgs e){

string url = string.Empty;

string SessionId = string.Empty;

&amp;nbsp; SforceService binding = new SforceService();

LoginResult loginResult = binding.login(&quot;username&quot;, &quot;passwordWithSecurityToken&quot;);

url = loginResult.serverUrl;

SessionId = loginResult.sessionId;

&lt;/pre&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
Cheers.......................&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/2389777552983630471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/10/login-in-salesforce-through-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/2389777552983630471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/2389777552983630471'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/10/login-in-salesforce-through-net.html' title='Login in salesforce through .Net Application'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-8054113128714462111</id><published>2011-10-07T06:10:00.000-07:00</published><updated>2012-03-26T04:41:26.826-07:00</updated><title type='text'>Visual Workflow In salesforce apex</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello Guys ,&lt;br /&gt;
We have some&amp;nbsp;pretty much interesting topic in salesforce its Visual Workflow.&lt;br /&gt;
&lt;br /&gt;
Visual Workflow:&lt;br /&gt;
&lt;br /&gt;
Flows represent your business processes and run in your Salesforce organization as rule-based applications.Flows are built in&amp;nbsp;a graphical interface and require no programing skills.They can be built quickly and are easily maintained.&lt;br /&gt;
&lt;br /&gt;
With Visual Workflow you can outline and manage procedures such as approval processes, interviews, or call center&amp;nbsp;questionnaires.&lt;br /&gt;
&lt;br /&gt;
For better understanding just download the pdf in which steps are clearly defined to make better understanding and implementation.&lt;br /&gt;
&lt;br /&gt;
Just go to Salesforce PDFs Tab on start of the page and Click on&amp;nbsp;&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: blue; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;a href=&quot;http://www.salesforce.com/us/developer/docs/firefly/salesforce_flow_designer.pdf&quot; style=&quot;color: blue; text-decoration: none;&quot;&gt;Visual Workflow Book&lt;/a&gt;.&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #333333; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 14px; line-height: 20px;&quot;&gt;Must implement the topic its just 30 min task.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: #c0a154; color: #333333; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 14px; line-height: 20px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; color: #333333; font-family: Georgia, Utopia, &#39;Palatino Linotype&#39;, Palatino, serif; font-size: 14px; line-height: 20px;&quot;&gt;Cheers.......&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/8054113128714462111/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/10/visual-workflow-in-salesforce-apex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/8054113128714462111'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/8054113128714462111'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/10/visual-workflow-in-salesforce-apex.html' title='Visual Workflow In salesforce apex'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-4894339858417301164</id><published>2011-10-03T03:09:00.000-07:00</published><updated>2012-03-26T05:58:13.593-07:00</updated><title type='text'>New Release Winter 12 In Apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello folks,&lt;br /&gt;
We have some new important features in Winter 12 Release.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;1. Read Only Mode :&lt;/b&gt;&lt;br /&gt;
By default, Visualforce pages have a limit of 50,000&amp;nbsp;records that can be queried in a single request, and iteration&amp;nbsp;components such as &amp;lt;apex:pageBlockTable&amp;gt; are limited to 1,000 iterations. For pages that do not need to modify&amp;nbsp;data, you can now enable read-only mode for the page, using the new readOnly attribute :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
&amp;lt;apex:page controller=&quot;SummaryStatsController&quot; readOnly=&quot;true&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;p&amp;gt;Here is a statistic: {!veryLargeSummaryStat}&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;/apex:page&amp;gt;&lt;br /&gt;
&lt;/pre&gt;
Setting a page to read-only mode relaxes the query limit to 1 million rows, allowing you to work with much large&amp;nbsp;of data. It also expands the iteration limit to 10,000 iterations.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;2.&amp;nbsp;label attribute for input components :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Support for overriding the default form field label has been added to &amp;lt;apex:inputField&amp;gt;. With this change, all form&amp;nbsp;input components support this attribute.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;3.&amp;nbsp;tabOrderHint attribute for &amp;lt;apex:inputField&amp;gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Another change for &amp;lt;apex:inputField&amp;gt; is the addition of the tabOrderHint attribute. This attribute lets you&lt;br /&gt;
specify the relative order of form fields on a page, for the purposes of tabbing through the form. It does not allow youto specify the actual value of a field&#39;s tabIndex HTML attribute. Instead, Visualforce uses the tabOrderHint to&amp;nbsp;calculate an appropriate HTML tabIndex for the field.&lt;br /&gt;
&lt;br /&gt;
tabOrderHint is not supported inside iteration components like &amp;lt;apex:pageBlockTable&amp;gt; or &amp;lt;apex:dataList&amp;gt;.&lt;br /&gt;
tabOrderHint is not currently available for input components other than &amp;lt;apex:inputField&amp;gt;. Other input&lt;br /&gt;
components like &amp;lt;apex:inputText&amp;gt; can use the tabIndex attribute instead.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;4. Package Install Improvements :&amp;nbsp;&lt;/b&gt;&lt;b&gt;New IsTest(OnInstall=true) Annotation&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Using the IsTest(OnInstall=true) annotation, you can control which Apex tests are executed during package installation.&amp;nbsp;This annotation is used for tests in managed or unmanaged packages. Test methods with this annotation, or methods that are&amp;nbsp;part of a test class that has this annotation, will always be executed during package installation. Tests annotated to run duringpackage installation must pass in order for the package installation to succeed. It is no longer possible to bypass a failing test.&amp;nbsp;during package installation. A test method or a class that doesn&#39;t have this annotation, or that is annotated with&amp;nbsp;isTest(OnInstall=false) or isTest, won&#39;t be executed during installation.&lt;br /&gt;
This annotation applies only to packages uploaded in Winter &#39;12 or later. Packages uploaded prior to Winter &#39;12 aren&#39;t yet&amp;nbsp;affected by this annotation and all their tests run during installation.&lt;br /&gt;
&lt;br /&gt;
Note:&amp;nbsp;Starting with Spring &#39;12, tests won&#39;t automatically run when a customer installs your package. If you want&amp;nbsp;to run tests upon package installation, we strongly recommend that you add the @isTest(OnInstall=true)&lt;br /&gt;
annotation to all test classes or test methods that you want executed, and subsequently, package and release a new&amp;nbsp;version of your app before Spring &#39;12.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;5.Visualforce Charting—Pilot :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The Winter &#39;12 release has a new pilot feature, Visualforce Charting. Visualforce charting is a collection of components&amp;nbsp;that provide a simple and intuitive way to create charts in your Visualforce pages and custom components. Visualforce&amp;nbsp;charting gives you an easy way to create customized business charts, based on data sets that you can create directly from&amp;nbsp;SOQL queries, or by building the data set in your own Apex code. By combining and configuring individual data series,&amp;nbsp;you can compose charts that display your data in ways meaningful to your organization.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Charts are defined using Visualforce components, which generate JavaScript that renders the chart within the browser.&amp;nbsp;Here&#39;s what a simple chart might look like:&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
&amp;lt;apex:page controller=&quot;PieChartCtlr&quot; title=&quot;Pie Chart&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:chart data=&quot;{!pieData}&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:pieSeries labelField=&quot;name&quot; dataField=&quot;data1&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/apex:chart&amp;gt;&lt;br /&gt;
&amp;lt;/apex:page&amp;gt;
&lt;/pre&gt;
Note : Contact salesforce.com to have Visualforce charting enabled for your organization.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;6.&amp;nbsp;New Sites Methods&lt;/b&gt;&lt;br /&gt;
The following new methods have been added to the Sites class:&lt;br /&gt;
&lt;br /&gt;
• getAdminEmail: Returns the email address of the site administrator.&lt;br /&gt;
• getAdminId: Returns the user ID of the site administrator.&lt;br /&gt;
&lt;br /&gt;
Additionally, createPortalUser now has an additional optional argument of type Boolean, which determines whether a&amp;nbsp;new user email is sent to the portal user.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;7.New System Methods: isBatch, isFuture, and isScheduled&lt;/b&gt;&lt;br /&gt;
The following methods have been added to the System class:&lt;br /&gt;
• isBatch: Determines if the currently executing code is invoked by a batch Apex job. Since a future method can&#39;t be&amp;nbsp;invoked from a batch Apex job, use this method to check if the currently executing code is a batch Apex job before you invoke a future method.&lt;br /&gt;
&lt;br /&gt;
• isFuture: Determines if the currently executing code is invoked by code contained in a method annotated with @future.&amp;nbsp;Since a future method can&#39;t be invoked from another future method, use this method to check if the current code is executing&amp;nbsp;within the context of a future method before you invoke a future method.&lt;br /&gt;
&lt;br /&gt;
• isScheduled: Determines if the currently executing code is invoked by a scheduled Apex job&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;8.Common Test Data Creation Methods in Public Test Classes.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Classes annotated with @isTest no longer have to be private. You can now create public test classes that expose common&amp;nbsp;methods for test data creation. These public methods can be called by tests outside the test class for setting up data that the&amp;nbsp;tests need to run against.&lt;br /&gt;
&lt;br /&gt;
Methods of a public test class can only be called from a running test, that is, a test method or code invoked by a test method,&amp;nbsp;and can&#39;t be called by a non-test request.&lt;br /&gt;
This is an example of a public test class that contains utility methods for test data creation:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
@isTest&lt;br /&gt;
public class TestUtil {&lt;br /&gt;
public static void createTestAccounts() {&lt;br /&gt;
// Create some test accounts&lt;br /&gt;
}&lt;br /&gt;
public static void createTestContacts() {&lt;br /&gt;
// Create some test contacts&lt;br /&gt;
}&lt;br /&gt;
}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;9.&amp;nbsp;Higher Governor Limits in Some Categories&lt;/b&gt;&lt;br /&gt;
The following governor limits are higher for Batch Apex and future methods:&lt;br /&gt;
• Total number of SOQL queries issued is 200 instead of 100.&lt;br /&gt;
• Total number of executed code statements is 1,000,000 instead of 200,000.&lt;br /&gt;
In addition, the heap size limit is now doubled and is raised for Batch Apex and future methods&lt;br /&gt;
• Total heap size is 6 MB.&lt;br /&gt;
• Total heap size for Batch Apex and future methods is 12 MB.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;10.Method Size Limit&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The size of a method is limited to 65,535 bytecode instructions in compiled form. Large methods that exceed the allowed&amp;nbsp;limit cause an exception to be thrown during the execution of your code.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;11.&amp;nbsp;New Schema Methods&lt;/b&gt;&lt;br /&gt;
The following new method has been added to the Schema.ChildRelationship class:&lt;br /&gt;
• isRestrictedDelete: Returns true if the parent object can&#39;t be deleted because it is referenced by a child object,&amp;nbsp;false otherwise. This prevents users from deleting any records that are part of a lookup relationship.&lt;br /&gt;
The following new methods have been added to the Schema.DescribeFieldResult class&lt;br /&gt;
&lt;br /&gt;
• isCascadeDelete: Returns true if the child object is deleted when the parent object is deleted, false otherwise. This&amp;nbsp;allows a cascade delete when a parent lookup record is deleted, allowing users to delete large numbers of records without&amp;nbsp;regard for sharing or visibility constraints.&lt;br /&gt;
&lt;br /&gt;
• isRestrictedDelete: Returns true if the parent object can&#39;t be deleted because it is referenced by a child object,&amp;nbsp;false otherwise. This prevents users from deleting any records that are part of a lookup relationship.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;12.&amp;nbsp;Getting the Currency Code for Single Currency Organizations&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The UserInfo getDefaultCurrency method now returns the organization&#39;s currency code for single currency&lt;br /&gt;
organizations.&lt;br /&gt;
&lt;br /&gt;
For Apex saved using Salesforce API version 22.0 or earlier, getDefaultCurrency returns null for single currency&amp;nbsp;organizations.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;13.&amp;nbsp;String Conversion of Number Fields&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Previously, when String.valueOf was called with a field of type Number of an sObject, it incorrectly treated the&amp;nbsp;number field as a Decimal when converting it to a String and used the String.valueOf(Decimal d) method to&amp;nbsp;perform the conversion to a String. Apex now correctly converts a number field to a Double before performing the&amp;nbsp;conversion and uses the corresponding String.valueOf(Double d) method to convert the Double value to a String.&amp;nbsp;One side effect of this change is that converted String values of number fields that have no decimal fraction now have&amp;nbsp;a decimal point (.0) in them where they didn&#39;t before.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;14.&amp;nbsp;Fix for Uncaught Exception Bug for Apex Code Saved Using Salesforce API version 20.0 or earlier&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Exceptions were not being caught in the catch block under a certain condition for Apex code saved using Salesforce API&amp;nbsp;version 20.0 or earlier. The exception wasn’t being caught in the catch block if the try block also threw an exception.&amp;nbsp;This bug has now been fixed for all versions of Apex.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Cheers................&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/4894339858417301164/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/10/new-release-winter-12-in-apex.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/4894339858417301164'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/4894339858417301164'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/10/new-release-winter-12-in-apex.html' title='New Release Winter 12 In Apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-7986583338616958378</id><published>2011-09-27T02:42:00.000-07:00</published><updated>2012-07-18T02:04:40.986-07:00</updated><title type='text'>Make Select List Required On Visualforce Page in Apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Hello guys ,&lt;br /&gt;
If we are creating a select list on Visualforce page its not possible to make it required by setting its attribute required=&quot;true&quot;.&lt;br /&gt;
&lt;br /&gt;
So we have to alter some code in that.&lt;br /&gt;
For example :&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;lt;apex:selectList value=&quot;{!countries}&quot;&amp;nbsp;&amp;nbsp;multiselect=&quot;false&quot; size=&quot;1&quot;&amp;gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:selectOptions value=&quot;{!items}&quot;/&amp;gt;

&amp;lt;/apex:selectList&amp;gt;

&lt;/pre&gt;
&lt;br /&gt;
items - &amp;gt; list of your selected items&lt;br /&gt;
countries - &amp;gt; variable which hold the selected value.&lt;br /&gt;
&lt;br /&gt;
required=&quot;true&quot; - &amp;gt; Did not work in this way ..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now I am writing some think like this..&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;lt;apex:form &amp;gt;



&amp;lt;apex:pageBlock &amp;gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:pageBlockSection &amp;gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:outputPanel&amp;nbsp;styleClass=&quot;requiredInput&quot;&amp;nbsp;layout=&quot;block&quot; id=&quot;pwPanel&quot; &amp;gt;

&amp;nbsp; &amp;nbsp;&amp;lt;apex:outputPanel&amp;nbsp;styleClass=&quot;requiredBlock&quot;/&gt;&lt;/pre&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:selectList value=&quot;{!countries}&quot; multiselect=&quot;false&quot; size=&quot;1&quot;&amp;gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:selectOptions value=&quot;{!items}&quot;/&amp;gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/apex:selectList&amp;gt;

&amp;nbsp; &amp;nbsp; &amp;lt;/apex:outputPanel&amp;gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:commandButton value=&quot;Test&quot; action=&quot;{!test}&quot; rerender=&quot;out&quot; status=&quot;status&quot;/&amp;gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:pageBlockSection&amp;gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:pageBlock&amp;gt;

&amp;nbsp; &amp;nbsp; &amp;lt;/apex:form&amp;gt;



&lt;/pre&gt;
Now this select list values will display as required even no need to put the required attribute.&lt;br /&gt;
&lt;br /&gt;
Cheers.....................&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/7986583338616958378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/make-select-list-required-on.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7986583338616958378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7986583338616958378'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/make-select-list-required-on.html' title='Make Select List Required On Visualforce Page in Apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-1865503398244355969</id><published>2011-09-12T03:50:00.000-07:00</published><updated>2012-05-23T23:38:14.022-07:00</updated><title type='text'>Attach document in Attachment Object using Visualforce page in Salesforce Apex</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello folks,&lt;br /&gt;
&lt;br /&gt;
We have interesting here...&lt;br /&gt;
Today I am going to attach the file to any object related list in attachment object.&lt;br /&gt;
&lt;br /&gt;
Whole code is given below.&lt;br /&gt;
&lt;br /&gt;
You just need to copy and paste this code in your visualforce page.&lt;br /&gt;
&lt;br /&gt;
Note: Please ware in mind you must have an object Id in your VF page URL like&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;https://ap1.visual.force.com/apex/InputFileAttachment?id=AnyObjectSFDCId&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It mean you are calling this VF page by sending the CurrentPage Id which would work as ParentId for the Attachment Object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
VF page:&lt;br /&gt;
=======&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;lt;apex:page Controller=&quot;InputFileAttachment&quot;&amp;gt;&amp;nbsp;
&amp;nbsp; &amp;lt;apex:sectionHeader title=&quot;Attach File &quot;/&amp;gt;
&amp;nbsp; &amp;lt;apex:form &amp;gt;
&amp;nbsp; &amp;lt;apex:pageBlock &amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:pageBlockButtons &amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:commandButton value=&quot;Attach New File&quot; action=&quot;{!AttachNewFile}&quot;/&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:pageBlockButtons&amp;gt;

&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:pageBlockSection &amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:inputFile value=&quot;{!Attach}&quot;&amp;gt;&amp;lt;/apex:inputFile&amp;gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:pageBlockSection&amp;gt;&amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;lt;/apex:pageBlock&amp;gt;
&amp;nbsp; &amp;lt;/apex:form&amp;gt;
&amp;lt;/apex:page&amp;gt;
&lt;/pre&gt;
Controller :&lt;br /&gt;
========&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public class InputFileAttachment {
&amp;nbsp; &amp;nbsp; public blob Attach {get;set;} &amp;nbsp;
&amp;nbsp; &amp;nbsp; string CurrentId ;
&amp;nbsp; 
&amp;nbsp; &amp;nbsp; public InputFileAttachment ()
&amp;nbsp; &amp;nbsp; { &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CurrentId = ApexPages.CurrentPage().getParameters().get(&#39;Id&#39;);&amp;nbsp; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; }&amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; public pagereference AttachNewFile()
&amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; try
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; delete [select id from Attachment where ParentId=:CurrentId];
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Blob b = Attach;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Attachment At = new Attachment(Name =&#39;NewFile&#39;+&#39;.jpg&#39;,body = b,parentId=CurrentId);
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; insert At;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }Catch(Exception ee){}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return null;
&amp;nbsp; &amp;nbsp; }
}
&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/1865503398244355969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/attach-document-in-attachment-object.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/1865503398244355969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/1865503398244355969'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/attach-document-in-attachment-object.html' title='Attach document in Attachment Object using Visualforce page in Salesforce Apex'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-5320437319762067687</id><published>2011-09-08T10:06:00.000-07:00</published><updated>2012-03-23T11:54:01.756-07:00</updated><title type='text'>toolbar background color in visualforce apex Salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Dear guys..&lt;br /&gt;
&lt;br /&gt;
I had a big issue while working with &amp;lt;apex:toolbar&amp;gt;. The default appearance is green-to-black gradient.&lt;br /&gt;
If we are setting in&lt;br /&gt;
&lt;br /&gt;
&amp;lt;apex:toolbar&amp;nbsp;style=&quot;background-color:blue&quot;&amp;gt; or any hexadecimal Number it does not works.&lt;br /&gt;
In this style sheet we have to include something else too.&lt;br /&gt;
&amp;lt;apex:toolbar&amp;nbsp;style=&quot;background-color:gray;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;background-image:none&lt;/span&gt;&quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The whole example is given below.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
&amp;lt;apex:page id=&quot;thePage&quot; standardstylesheets=&quot;true&quot; showheader=&quot;false&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;apex:toolbar id=&quot;theToolbar&quot; height=&quot;50px;&quot; itemSeparator=&quot;disc&quot; style=&quot;background-color:gray;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: purple;&quot;&gt;background-image:none&lt;/span&gt;&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:outputText value=&quot;Sample Toolbar&quot;/&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:toolbarGroup itemSeparator=&quot;disc&quot; id=&quot;toobarGroupLinks&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:outputLink value=&quot;http://www.salesforce.com&quot;&amp;gt;&amp;lt;span style=&quot;color:Blue&quot;&amp;gt;salesforce&amp;lt;/span&amp;gt;&amp;lt;/apex:outputLink&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:outputLink value=&quot;http://developer.salesforce.com&quot;&amp;gt;&amp;lt;span style=&quot;color:Blue&quot;&amp;gt;apex developer network&amp;lt;/span&amp;gt;&amp;lt;/apex:outputLink&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:toolbarGroup&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:toolbarGroup itemSeparator=&quot;disc&quot; location=&quot;right&quot; id=&quot;toobarGroupForm&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:form id=&quot;theForm&quot;&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:inputText id=&quot;theInputText&quot;&amp;gt;Enter Text&amp;lt;/apex:inputText&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:commandLink id=&quot;theCommandLink&quot;&amp;gt;&amp;lt;span style=&quot;color:Blue&quot;&amp;gt;Search&amp;lt;/span&amp;gt;&amp;lt;/apex:commandLink&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:form&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:toolbarGroup&amp;gt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/apex:toolbar&amp;gt;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;lt;/apex:page&amp;gt;&lt;br /&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/5320437319762067687/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/toolbar-background-color-in-visualforce.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/5320437319762067687'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/5320437319762067687'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/toolbar-background-color-in-visualforce.html' title='toolbar background color in visualforce apex Salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-3344333337722719346</id><published>2011-09-05T05:27:00.000-07:00</published><updated>2014-08-02T07:48:02.527-07:00</updated><title type='text'>Changing Date Format On Visualforce Page in Salesforce Apex</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Dear Guys....&lt;br /&gt;
&lt;br /&gt;
We have a some idea regarding date format on visualforce page.Usually when we display the date field value on visualforce page it make the date format.&lt;br /&gt;
In case we dont want to see this format we need to show only the format which should be easy to understand to all like some different formats.&lt;br /&gt;
MM-DD-YYYY or YYYY-MM-DD Like these format.&lt;br /&gt;
&lt;br /&gt;
We have to ways to achieve the date.&lt;br /&gt;
1. We can create a method by passing parameter type Date or Date Time whatever you passing depend on you.&lt;br /&gt;
And then call this method before showing the date field value of visualforce page.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;Opportunity opp = &amp;nbsp;[select CloseDate from Opportunity Limit 1];
string DateString1 = ConvertDateFormat(opp.CloseDate);
public string ConvertDateFormat(Date d){ 
string DateString ;
string month;
&amp;nbsp; if(d!=null){
&amp;nbsp; &amp;nbsp; &amp;nbsp;integer d1 = d.day();
&amp;nbsp; &amp;nbsp; &amp;nbsp;integer d2 = d.month();
&amp;nbsp; &amp;nbsp; &amp;nbsp;if(d2 == 1)
&amp;nbsp; &amp;nbsp; &amp;nbsp; {
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; month = &#39;january&#39;; &amp;nbsp; &amp;nbsp; 
&amp;nbsp; &amp;nbsp; }
&amp;nbsp; &amp;nbsp; if(
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d2 == 2){month = &#39;February&#39;; 
&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&amp;nbsp; &amp;nbsp; if(
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; d2 == 3){month = &#39;March&#39;; &amp;nbsp; //so on.............................
&amp;nbsp; &amp;nbsp; &amp;nbsp;}
&amp;nbsp; &amp;nbsp; integer d3 = d.year();
&amp;nbsp; &amp;nbsp; DateString = string.valueOf(d1)+&#39;-&#39;+month+&#39;-&#39;+string.valueOf(d3);
}return DateString;

}

system.debug(&#39;***********&#39;+DateString1);
&lt;/pre&gt;
So guys in this why we can format our date as we need.&lt;br /&gt;
2. Apart from this code we have another way to directly format the date on visualforce page.&lt;br /&gt;
We have a Apex Tag &amp;lt;apex:parma&amp;gt; which pass the value to the output text..&lt;br /&gt;
Lets say we have a date Field we can directly pass it to the visualforce tag.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;lt;apex:outputText value=&quot;{0,date,dd-MMMM-yyyy}&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:param value=&quot;{!&amp;nbsp;Opp.CloseDate}&quot; /&amp;gt;
&amp;lt;/apex:outputText&amp;gt;

&lt;/pre&gt;
Highlighted text decided the in what way your date format would be display on visualforce page. You can this format by replacing the value in the format.&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;{0,date,dd-MMMM-yyyy}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;{0,date,MMMM-&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;dd&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;-yyyy}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;{0,date,MMMM-yyyy-&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;dd&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;{0,date,dd-MM-yy}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;{0,date,MM-&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;dd&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;-yyyy}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;{0,date,MM-yy-&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;dd&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: orange;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
You can check more probabilities by your self will make better understanding for you.&lt;br /&gt;
&lt;br /&gt;
Please promote it this post help you and also let me know if I am doing something wrong in the post.&lt;br /&gt;
&lt;br /&gt;
Thanks&lt;br /&gt;
&lt;br /&gt;
Cheers.........................&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/3344333337722719346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/changing-date-format-on-visualforce.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/3344333337722719346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/3344333337722719346'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/changing-date-format-on-visualforce.html' title='Changing Date Format On Visualforce Page in Salesforce Apex'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-562284478188502883</id><published>2011-09-02T01:52:00.000-07:00</published><updated>2012-03-26T05:55:17.767-07:00</updated><title type='text'>Custom Settings in salesforce apex</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello folks..&lt;br /&gt;
We have some interesting here......&lt;br /&gt;
&lt;br /&gt;
Some times we need to configure some custom objects which are apart from any relationship. Suppose we need to configure a object Name System Configuration where we are putting &amp;nbsp;some values . Dynamic values mean we can change these values based on our requirement.&lt;br /&gt;
&lt;br /&gt;
Now while development we are setting the criteria based on these values.&lt;br /&gt;
&lt;br /&gt;
Lets say we a object Name System_Configuration in which we have two date type field.&lt;br /&gt;
Start_Date&lt;br /&gt;
End_Date&lt;br /&gt;
&lt;br /&gt;
Now we are querying the Any List of object suppose&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
List&amp;lt;Opportunity&amp;gt; lstOpprtunity = [select id,Name,Stage from Opportunity where CloseDate&amp;nbsp;Start_Date And&amp;nbsp;CloseDate &amp;lt;=End_Date];
&lt;/pre&gt;
So the thing is first you will have to query on the System_Configuration Object to pick the Field values Start_Date And End_Date and only then you can use these values in your filter criteria.&lt;br /&gt;
&lt;br /&gt;
Now if we want escaping these kind of unnecessary queries we have the SALESFORCE CUSTOM SETTINGS .&lt;br /&gt;
&lt;br /&gt;
These custom setting are just like salesforce custom object but these object have limited number of data type.&lt;br /&gt;
And having different type of methods which provide you convenience way to extract the data of these custom setting objects.&lt;br /&gt;
&lt;br /&gt;
Why I am referring custom setting while we can do this by using salesforce custom objects. The reason is give below with the more descriptive definition of Custom setting.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: Arial, Helvetica, Verdana, sans-serif;&quot;&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div style=&quot;margin-top: 1em;&quot;&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;color: #3d85c6;&quot;&gt;&lt;b&gt;Custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user. All custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database. This data can then be used by formula fields, validation rules,&amp;nbsp;Apex, and the&amp;nbsp;&lt;span id=&quot;d233576e2098&quot;&gt;&lt;a href=&quot;http://www.blogger.com/post-edit.g?blogID=7487142140156375335&amp;amp;postID=562284478188502883&quot; name=&quot;d233576e2098&quot; style=&quot;text-decoration: underline;&quot;&gt;&lt;/a&gt;Web services&amp;nbsp;API&lt;/span&gt;.&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
The best example of custom setting is given below link :&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
Go a head the try it your self.&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;font-size: 14px;&quot;&gt;
&lt;a href=&quot;http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_custom_settings.htm&quot;&gt;http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_custom_settings.htm&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;background-color: white; font-family: Arial, Helvetica, Verdana, sans-serif; font-size: 14px;&quot;&gt;Cheers.................................................&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/562284478188502883/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/custom-settings-in-salesforce-apex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/562284478188502883'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/562284478188502883'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/09/custom-settings-in-salesforce-apex.html' title='Custom Settings in salesforce apex'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-658618566017191462</id><published>2011-08-29T01:55:00.000-07:00</published><updated>2012-03-26T04:04:25.116-07:00</updated><title type='text'>Query String Parameters in Apex Salesforce And Param Visualforce Component.</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Hello guys.....&lt;br /&gt;
Its much interesting topic for the beginner of salesforce developer.&lt;br /&gt;
&lt;br /&gt;
Have a look on Qurey String Parameter &amp;nbsp;:&lt;br /&gt;
Create a visualforcve page with Account as Standard Controller to show the All contact link and their phone no detail for a single account Id.&lt;br /&gt;
&lt;br /&gt;
I am creating a simple visualforce standard controller of Account Object.
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
&amp;lt;apex:page standardController=&quot;Account&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;lt;apex:pageBlock title=&quot;Contacts&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;lt;apex:form&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:dataTable value=&quot;{!account.Contacts}&quot; var=&quot;contact&quot; cellPadding=&quot;4&quot;&amp;nbsp;border=&quot;1&quot;&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column&amp;gt;&amp;lt;apex:facet name=&quot;header&quot;&amp;gt;Name&amp;lt;/apex:facet&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:commandLink&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{!contact.Name}&amp;lt;apex:param name=&quot;cid&quot; value=&quot;{!contact.id}&quot;/&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:commandLink&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;apex:facet name=&quot;header&quot;&amp;gt;Phone&amp;lt;/apex:facet&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {!contact.Phone}
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/apex:column&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/apex:dataTable&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/apex:form&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;lt;/apex:pageBlock&amp;gt;
&amp;nbsp; &amp;nbsp; &amp;lt;apex:detail subject=&quot;{!$CurrentPage.parameters.cid}&quot; relatedList=&quot;false&quot; title=&quot;false&quot;/&amp;gt;
&amp;lt;/apex:page&amp;gt;
&lt;/pre&gt;
After creating the visualforce page ur URL would be somthing like this..&lt;br /&gt;
https://ap1.visual.force.com/apex/QueryStringParameters&lt;br /&gt;
put any of salesforce Account SFDC id which contains number of contact &amp;nbsp;in query string like this .. &amp;nbsp;?id=00190000005g1db&lt;br /&gt;
Now url would be&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;https://.visual.force.com/apex/QueryStringParameters?id=00190000005g1db

this is ur account Id starting from 001

&lt;/pre&gt;
Now will can see the details Contact Name in First Column and Phone in second column.&lt;br /&gt;
Now Name column is a link when u click on this link ...u can see the detail of that particular contact. Now the thing is how is this happening.&lt;br /&gt;
&lt;br /&gt;
When u click on that link u r passing a query stinng parameter through Apex Param tag.&lt;br /&gt;
&amp;lt;apex:param name=&quot;cid&quot; value=&quot;{!contact.id}&quot;/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Its send the contact Id to the cid parameter which pass in to the&amp;nbsp;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;&amp;nbsp;&amp;lt;apex:detail subject={!$CurrentPage.parameters.cid}&quot; relatedList=&quot;false&quot; title=&quot;false&quot;/&amp;gt;&lt;/pre&gt; Visualforce Tag.




U can see&amp;nbsp;{!$CurrentPage.parameters.cid} is the standard format to get the query string as parameter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cheers.............................&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/658618566017191462/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/08/query-string-parameters-in-apex.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/658618566017191462'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/658618566017191462'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/08/query-string-parameters-in-apex.html' title='Query String Parameters in Apex Salesforce And Param Visualforce Component.'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-7580066262671206176</id><published>2011-08-27T08:01:00.000-07:00</published><updated>2012-03-26T04:42:42.934-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Test"/><title type='text'>Apex heap size too large And Too Many Script Statement in apex salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hi guys these kind of error I had faced many time because of the large data in organisations. When ever we process the number of records governor limit hit these kind of error.&lt;br /&gt;
&lt;br /&gt;
Normally we queried the records like.&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
List&amp;lt;Account&amp;gt; lstAcc = [select Id,Name from Account];
for(Account Acc :lstAcc){
&amp;nbsp; &amp;nbsp; //your code here &amp;nbsp; &amp;nbsp; Running statement for each records. And Hitting the script statement limit&lt;br /&gt;
}&lt;/pre&gt;
We can use this in another way by which we can escape two kind of error mentioned above.&lt;br /&gt;
We can do a SOQL inside the for loop something like this.&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
for(List&amp;lt;Account&amp;gt; lst :[select Id,Name from Account]){
&amp;nbsp; &amp;nbsp; &amp;nbsp;// Loop first statement having 200 records in single batch.
}&lt;/pre&gt;
This way is only for when you are not tracing one by one object and making calculation. We can use this ways if we are adding all records in a new list .&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
for(List&amp;lt;Account&amp;gt; lst :[select Id,Name from Account]){
&amp;nbsp;&amp;nbsp; newList.addall(lst);
}
&lt;/pre&gt;
Suppose we have 500 records to process the this loop will run max 3 time.&lt;br /&gt;
&lt;br /&gt;
This line of code reducing the script statement because this structure make the batch of 200 record for a single statement. And This is also reducing the Apex Heap size.&lt;br /&gt;
&lt;br /&gt;
Cheers..........................&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/7580066262671206176/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/08/apex-heap-size-too-large-and-too-many.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7580066262671206176'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/7580066262671206176'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/08/apex-heap-size-too-large-and-too-many.html' title='Apex heap size too large And Too Many Script Statement in apex salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7487142140156375335.post-4407206617595562487</id><published>2011-08-27T07:46:00.000-07:00</published><updated>2012-03-23T20:15:25.851-07:00</updated><title type='text'>Best Practice of escaping the govenner limits in apex salesforce</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hi guys I have a &amp;nbsp;interesting topic to escaping the governor limits hitting in our apex script.&lt;br /&gt;
I just have the trigger on object Account which exposing some limits hitting in apex. And we can escape it by inspecting the limits while executing the script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
trigger LimitExample on Account (after delete, after insert, after update) {&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.debug(&#39;Total Number of SOQL Queries allowed in this apex code context: &#39; + &amp;nbsp;Limits.getLimitQueries());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.debug(&#39;Total Number of records that can be queried &amp;nbsp;in this apex code context: &#39; + &amp;nbsp;Limits.getLimitDmlRows());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.debug(&#39;Total Number of DML statements allowed in this apex code context: &#39; + &amp;nbsp;Limits.getLimitDmlStatements() );&lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.debug(&#39;Total Number of script statements allowed in this apex code context: &#39; + &amp;nbsp;Limits.getLimitScriptStatements()); &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;//This code inefficiently queries the Opportunity object in two seperate queries&lt;br /&gt;
&amp;nbsp; &amp;nbsp; List&amp;lt;Opportunity&amp;gt; opptys = [select id, description, name, accountid, &amp;nbsp;closedate, stagename from Opportunity where accountId IN :Trigger.newMap.keySet()]; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.debug(&#39;1.Number of Queries used in this apex code so far: &#39; + Limits.getQueries());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.debug(&#39;2.Number of rows queried in this apex code so far: &#39; + Limits.getDmlRows());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; System.debug(&#39;3. Number of script statements used so far : &#39; + &amp;nbsp;Limits.getDmlStatements()); &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;//NOTE:Proactively determine if there are too many Opportunities to update and avoid governor limits&lt;br /&gt;
&amp;nbsp; &amp;nbsp;if (opptys.size() + Limits.getDMLRows() &amp;gt; Limits.getLimitDMLRows()) {&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.debug(&#39;Need to stop processing to avoid hitting a governor limit. Too many related Opportunities to update in this trigger&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.debug(&#39;Trying to update &#39; + opptys.size() + &#39; opportunities but governor limits will only allow &#39; + Limits.getLimitDMLRows());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (Account a: Trigger.new)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; a.addError(&#39;You are attempting to update the addresses of too many accounts at once. Please try again with fewer accounts.&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; } &lt;br /&gt;
&amp;nbsp; &amp;nbsp; else{&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.debug(&#39;Continue processing. Not going to hit DML governor limits&#39;);&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.debug(&#39;Going to update &#39; + opptys.size() + &#39; opportunities and governor limits will allow &#39; + Limits.getLimitDMLRows());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(Account a : Trigger.new){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.debug(&#39;Number of script statements used so far : &#39; + &amp;nbsp;Limits.getDmlStatements()); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for(Opportunity o: opptys){&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if(o.accountid == a.id)&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;o.description = &#39;testing&#39;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;} &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; update opptys;&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.debug(&#39;Total heap size: &#39; + &amp;nbsp;Limits.getLimitHeapSize());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.debug(&#39;Final number of script statements used so far : &#39; + &amp;nbsp;Limits.getDmlStatements());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; System.debug(&#39;Final heap size: &#39; + &amp;nbsp;Limits.getHeapSize());&lt;br /&gt;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;br /&gt;
&amp;nbsp; &amp;nbsp; } &lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/pre&gt;
cheers.....................&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://salesforceapexcodecorner.blogspot.com/feeds/4407206617595562487/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/08/best-practice-of-escaping-govenner.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/4407206617595562487'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7487142140156375335/posts/default/4407206617595562487'/><link rel='alternate' type='text/html' href='http://salesforceapexcodecorner.blogspot.com/2011/08/best-practice-of-escaping-govenner.html' title='Best Practice of escaping the govenner limits in apex salesforce'/><author><name>Vijay</name><uri>http://www.blogger.com/profile/09231642742314421862</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-vAVL2tS6Eug/T8S9-qko7dI/AAAAAAAAAQI/h_4EYAFYilY/s220/IMG_1860.JPG'/></author><thr:total>0</thr:total></entry></feed>