<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Shiva Blog</title>
	<atom:link href="http://shivasoft.in/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://shivasoft.in/blog</link>
	<description>Explore your knowledge and share with world</description>
	<lastBuildDate>Wed, 16 May 2012 18:11:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>CSS 3 Tutorial &#8211; Rounded Corner and Shadow Border effect</title>
		<link>http://shivasoft.in/blog/webtech/web/css-3-tutorial-rounded-corner-and-shadow-border-effect/</link>
		<comments>http://shivasoft.in/blog/webtech/web/css-3-tutorial-rounded-corner-and-shadow-border-effect/#comments</comments>
		<pubDate>Wed, 16 May 2012 18:11:04 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS 3]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2856</guid>
		<description><![CDATA[Style the Border in HTML with the Help of CSS 3 Border Style
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/web/complete-css-3-tutorial-transform-operations/' rel='bookmark' title='Complete CSS 3 Tutorial &#8211; Transform Operations'>Complete CSS 3 Tutorial &#8211; Transform Operations</a></li>
<li><a href='http://shivasoft.in/blog/webtech/web/create-pure-css-based-menu-step-by-step-tutorial/' rel='bookmark' title='Create Pure CSS based Menu &#8211; Step by Step Tutorial'>Create Pure CSS based Menu &#8211; Step by Step Tutorial</a></li>
<li><a href='http://shivasoft.in/blog/webtech/complete-css-selector-tutorial-for-the-beginners/' rel='bookmark' title='Complete CSS Selector Tutorial for the beginners'>Complete CSS Selector Tutorial for the beginners</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><a title="CSS 3 Tutorial - Transform" href="http://shivasoft.in/blog/webtech/web/complete-css-3-tutorial-transform-operations/">Previously we have seen the Transform Operations using CSS3</a>. In this article i will depict the New Border Properties in CSS 3. With the help of CSS 3, we can perform following two operations on border :</p>
<ol>
<li>Rounded Corner/ Border</li>
<li>Border Shadow</li>
</ol>
<h3><a title="Live Demo CSS3 Rounded Corner" href="http://www.shivasoft.in/blog/wp-content/uploads/demos/CSS3/Border.html">Live Demo – Click Here<span id="more-2856"></span></a></h3>
<p><strong>1. Rounded Corner</strong></p>
<p style="text-align: justify;">Before CSS3, if you wanted to create the rounded corner border then it was not the straight job, it needed lots of programming stuff. There were alternatives like using sprite of images or jQuery plugins etc. However with the help of CSS 3 it is very straight as simple as shown below:</p>
<pre class="brush: xml; title: ; notranslate">
border-radius:25px;
-moz-border-radius:25px; /* Firefox 3.6 and earlier */
</pre>
<p>Using Border-radius property we can achieve the result. But for IE first line will work and for Mozilla 2nd line of code will work from above code snippet.</p>
<div id="attachment_2857" class="wp-caption aligncenter" style="width: 542px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/05/CSS-3-Border-Rounded-Corner.png"><img class="size-full wp-image-2857" title="CSS 3 Border - Rounded Corner" src="http://shivasoft.in/blog/wp-content/uploads/2012/05/CSS-3-Border-Rounded-Corner.png" alt="CSS 3 Border - Rounded Corner" width="532" height="60" /></a><p class="wp-caption-text">CSS 3 Border - Rounded Corner</p></div>
<p><strong>2. Border Shadow</strong><br />
If you want to give some shadow effect to the borders then its what everyone was waited for:<br />
<em><strong></strong></em></p>
<p><em><strong>Syntax :</strong> </em></p>
<p><em>box-shadow: h-shadow v-shadow blur spread color inset;</em></p>
<pre class="brush: xml; title: ; notranslate">
box-shadow: 5px 5px 10px #888888;
</pre>
<div id="attachment_2858" class="wp-caption aligncenter" style="width: 554px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/05/CSS-3-Border-Shadow.png"><img class="size-full wp-image-2858" title="CSS 3 Border - Shadow" src="http://shivasoft.in/blog/wp-content/uploads/2012/05/CSS-3-Border-Shadow.png" alt="CSS 3 Border - Shadow" width="544" height="63" /></a><p class="wp-caption-text">CSS 3 Border - Shadow</p></div>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/web/complete-css-3-tutorial-transform-operations/' rel='bookmark' title='Complete CSS 3 Tutorial &#8211; Transform Operations'>Complete CSS 3 Tutorial &#8211; Transform Operations</a></li>
<li><a href='http://shivasoft.in/blog/webtech/web/create-pure-css-based-menu-step-by-step-tutorial/' rel='bookmark' title='Create Pure CSS based Menu &#8211; Step by Step Tutorial'>Create Pure CSS based Menu &#8211; Step by Step Tutorial</a></li>
<li><a href='http://shivasoft.in/blog/webtech/complete-css-selector-tutorial-for-the-beginners/' rel='bookmark' title='Complete CSS Selector Tutorial for the beginners'>Complete CSS Selector Tutorial for the beginners</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/webtech/web/css-3-tutorial-rounded-corner-and-shadow-border-effect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Streaming API Using JQuery &#8211; Salesforce</title>
		<link>http://shivasoft.in/blog/others/tips/streaming-api-using-jquery-salesforce/</link>
		<comments>http://shivasoft.in/blog/others/tips/streaming-api-using-jquery-salesforce/#comments</comments>
		<pubDate>Sun, 06 May 2012 11:40:48 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[Salesforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2843</guid>
		<description><![CDATA[Tutorial of Streaming API in Salesforce with Source code and Demo Video - Implementation of Bayeux protocol and CometD using JQuery and JSON
No related posts.]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Push technology is a model of Internet-based communication in which information transfer is initiated <strong>from a server to the client</strong>. Also called the publish/subscribe model, this type of communication is the opposite of pull technology in which a request for information is made from a client to the server. The information that’s sent by the server is typically specified in advance. When using Streaming API, you specify the information the client receives by creating a PushTopic. The client then subscribes to the PushTopic channel to be notified of events that match the PushTopic criteria.</p>
<p style="text-align: justify;">In push technology, the server pushes out information to the client after the client has subscribed to a channel of information. In order for the client to receive the information, the client must maintain a connection to the server. <strong>Streaming API uses the Bayeux protocol and <a title="Wikipedia Tutorial" href="http://en.wikipedia.org/wiki/Comet_(programming)" rel="nofollow">CometD</a></strong>, so the client to server connection is maintained through long polling.</p>
<p>The Bayeux protocol and CometD both use long polling.</p>
<ol>
<li>Bayeux is a protocol for transporting asynchronous messages, primarily over HTTP.</li>
<li>CometD is a scalable HTTP-based event routing bus that<strong> uses an AJAX push technology pattern known as Comet</strong>. It implements the Bayeux protocol.</li>
</ol>
<p>There is nice jQuery plugin available on web which implements Bayeux protocol and CometD.</p>
<p><a title="Streaming API Documentation" href="http://www.salesforce.com/us/developer/docs/api_streaming/index_Left.htm#StartTopic=Content/code_sample_java_add_source.htm">Navigate here for Salesforce documentation for Streaming API.</a></p>
<p><strong>Common Terms used in Streaming API:</strong></p>
<ul>
<li><strong>Event :</strong> Either the creation of a record or the update of a record. Each event may trigger a notification.</li>
<li><strong>Notification :</strong> A message in response to an event. The notification is sent to a channel to which one or more clients are subscribed.</li>
<li><strong>PushTopic :</strong> A record that you create. The essential element of a PushTopic is the SOQL query. The PushTopic defines a Streaming API channel.</li>
</ul>
<p><strong>Example used in this article : </strong></p>
<p><strong></strong>I want notifications about all opportunity whose status is won.<br />
<em>First step to implement any streaming API is to create the Push Topic, which is going to subscribed by all the clients.</em><br />
<strong></strong></p>
<p><strong>Create PushTopic:</strong></p>
<p>To create PushTopic, we will need the developer console of the Salesforce and assume that the name of the topic is &#8220;WonOpportunity&#8221;.</p>
<pre class="brush: csharp; title: ; notranslate">
PushTopic pushTopic = new PushTopic();
pushTopic.ApiVersion = 23.0;
pushTopic.Name = 'WonOpportunity';
pushTopic.Description = 'Notify if the Opportunity won';
pushTopic.NotifyForOperations = 'All';
pushTopic.NotifyForFields = 'Referenced';
pushtopic.Query = 'Select o.OwnerId, o.Name, o.IsWon, o.Id, o.Amount From Opportunity o WHERE o.IsWon = true';
insert pushTopic;
System.debug('Created new PushTopic: '+ pushTopic.Id);
</pre>
<div id="attachment_2845" class="wp-caption aligncenter" style="width: 655px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/05/Salesforce-Streaming-API-Create-Push-topic.png"><img class=" wp-image-2845  " title="Salesforce Streaming API - Create Push topic" src="http://shivasoft.in/blog/wp-content/uploads/2012/05/Salesforce-Streaming-API-Create-Push-topic-1024x332.png" alt="Salesforce Streaming API - Create Push topic" width="645" height="209" /></a><p class="wp-caption-text">Salesforce Streaming API - Create Push topic</p></div>
<p><strong><span id="more-2843"></span>Step 2:</strong><br />
Download the CometD compressed archive (.tgz) file from<a title="cometd implementation" href="http://download.cometd.org/cometd-2.2.0-distribution.tar.gz" rel="nofollow"> http://download.cometd.org/cometd-2.2.0-distribution.tar.gz</a><br />
<strong></strong></p>
<p><strong>Step 3:</strong><br />
In the extracted folder you will find the war file at location &#8220;cometd-2.2.0/cometd-javascript/common/target&#8221;.</p>
<p>Unpack that war file using below DOS command in Windows and same command will work on shell also</p>
<pre class="brush: powershell; title: ; notranslate">
cd cometd-2.2.0/cometd-javascript/common/target
jar xvf cometd-javascript-common-2.2.0.war org/cometd.js
</pre>
<div id="attachment_2846" class="wp-caption aligncenter" style="width: 637px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/05/Salesforce-UnPack-war-file-Streaming-API.png"><img class="size-full wp-image-2846" title="Salesforce UnPack war file - Streaming API" src="http://shivasoft.in/blog/wp-content/uploads/2012/05/Salesforce-UnPack-war-file-Streaming-API.png" alt="Salesforce UnPack war file - Streaming API" width="627" height="150" /></a><p class="wp-caption-text">Salesforce UnPack war file - Streaming API</p></div>
<p>If you will not follow the above step and if use different &#8220;cometd.js&#8221; file then you may get error <strong>“Uncaught ReferenceError: org is not defined”</strong><br />
<strong></strong></p>
<p><strong>Step 4:</strong><br />
Extract the following JavaScript files from &#8220;<em>cometd-2.2.0-distribution.tar.gz</em>&#8221;</p>
<ul>
<li>cometd-2.2.0/cometd-javascript/common/target/org/cometd.js <em>(This file must be from war file)</em></li>
<li>cometd-2.2.0/cometd-javascript/jquery/src/main/webapp/jquery/jquery-1.5.1.js</li>
<li>cometd-2.2.0/cometd-javascript/jquery/src/main/webapp/jquery/json2.js</li>
<li>cometd-2.2.0/cometd-javascript/jquery/src/main/webapp/jquery/jquery.cometd.js</li>
</ul>
<p><strong>Step 5:</strong><br />
Create a Visualforce page with following code :</p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:page &gt;

&lt;apex:includeScript value=&quot;{!URLFOR($Resource.SteamingAPI, 'StreaminAPI/JQueryComet/Cometd.js')}&quot;/&gt;
&lt;apex:includeScript value=&quot;{!URLFOR($Resource.SteamingAPI, 'StreaminAPI/jquery_1.5.2.min.js')}&quot;/&gt;
&lt;apex:includeScript value=&quot;{!URLFOR($Resource.SteamingAPI, 'StreaminAPI/JQueryComet/json2.js')}&quot;/&gt;
&lt;apex:includeScript value=&quot;{!URLFOR($Resource.SteamingAPI, 'StreaminAPI/JQueryComet/jquery.cometd.js')}&quot;/&gt;

&lt;apex:includeScript value=&quot;{!URLFOR($Resource.SteamingAPI, 'StreaminAPI/Style/jquery-animate-css-rotate-scale.js')}&quot;/&gt;
&lt;apex:includeScript value=&quot;{!URLFOR($Resource.SteamingAPI, 'StreaminAPI/Style/jquery-css-transform.js')}&quot;/&gt;

&lt;apex:stylesheet value=&quot;{!URLFOR($Resource.SteamingAPI, 'StreaminAPI/Style/style.css')}&quot;/&gt;

&lt;div class=&quot;menu&quot;&gt;
&lt;!-- Place holder for notifications --&gt;
&lt;/div&gt;

	 &lt;script type=&quot;text/javascript&quot;&gt;
	    var $jq = jQuery.noConflict();

            $jq('.item').click(
                function(){
                    var $this = $jq(this);
                    expand($this);
                }
            );
            function expand($elem){
                var angle = 0;
                var t = setInterval(function () {
                    if(angle == 1440){
                        clearInterval(t);
                        return;
                    }
                    angle += 40;
                    $jq('.link',$elem).stop().animate({rotate: '+=-40deg'}, 0);
                },10);
                $elem.stop().animate({width:'500px'}, 1000)
                .find('.item_content').fadeIn(400);
            }

           function createEle(data)
           {
	           	var $itemDiv = $jq(document.createElement('div'));
	           	$itemDiv.addClass('item');

	           	var $anch =  $jq(document.createElement('a'));
	           	$anch.addClass('link');
	           	$anch.addClass('icon_alert');

	           	var $contentDiv = $jq(document.createElement('div'));
	           	$contentDiv.addClass('item_content');

	           	var $h2 = $jq(document.createElement('h2'));
	           	$h2.html('Won New Opportunity');
	           	$contentDiv.append($h2);

	           	$contentDiv.append('&lt;br /&gt;Name : '+data.Name+' &lt;br /&gt;	Amount : '+data.Amount+' &lt;br /&gt;&lt;a href=&quot;#&quot;&gt; Navigate to Opportunity &lt;/a&gt;');

	           	$itemDiv.append($anch);
	           	$itemDiv.append($contentDiv);
	           	$jq(&quot;.menu&quot;).append($itemDiv);
	           	expand($itemDiv);
           }

           $jq(function() {
			 	 // Connect to the CometD endpoint

	            $jq.cometd.init({
	               url: window.location.protocol+'//'+window.location.hostname+'/cometd/23.0/',
	               requestHeaders: { Authorization: 'OAuth {!$Api.Session_ID}'}
	           });

	          $jq.cometd.subscribe('/topic/WonOpportunity', function(message) {
	          		createEle(message.data.sobject);
	            });

			});

        &lt;/script&gt;
&lt;/apex:page&gt;
</pre>
<p>After saving this page, open same salesforce instance in other browser or tab and make change to any opportunity with status &#8220;won&#8221;, it will display an alert that opportunity is won.<br />
<strong>Output:</strong></p>
<div id="attachment_2847" class="wp-caption aligncenter" style="width: 553px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/05/Salesforce-Streaming-API-Example.png"><img class=" wp-image-2847 " title="Salesforce Streaming API Example" src="http://shivasoft.in/blog/wp-content/uploads/2012/05/Salesforce-Streaming-API-Example.png" alt="Salesforce Streaming API Example" width="543" height="340" /></a><p class="wp-caption-text">Salesforce Streaming API Example</p></div>
<p><strong>JSON Reponse:</strong><br />
following JSON response we gets from Streaming API. The Rows returned in Object depends upon the Push topic create earlier.</p>
<pre class="brush: xml; title: ; notranslate">
[
   {
      &quot;channel&quot;:&quot;/topic/WonOpportunity&quot;,
      &quot;data&quot;:{
         &quot;event&quot;:{
            &quot;type&quot;:&quot;created&quot;,
            &quot;createdDate&quot;:&quot;2012-05-05T10:06:45.000+0000&quot;
         },
         &quot;sobject&quot;:{
            &quot;Name&quot;:&quot;om&quot;,
            &quot;IsWon&quot;:true,
            &quot;Amount&quot;:null,
            &quot;OwnerId&quot;:&quot;00590000000Gl5VAAS&quot;,
            &quot;Id&quot;:&quot;00690000006C8yFAAS&quot;
         }
      }
   },
   {
      &quot;channel&quot;:&quot;/meta/connect&quot;,
      &quot;advice&quot;:{
         &quot;reconnect&quot;:&quot;retry&quot;,
         &quot;interval&quot;:0,
         &quot;timeout&quot;:110000
      },
      &quot;successful&quot;:true,
      &quot;id&quot;:&quot;3&quot;
   }
]
</pre>
<p><strong>Debugging Streaming API:</strong><br />
We can use &#8220;<strong>firebug</strong>&#8221; plugin of Mozilla to check whether the http request is made or not from JQuery (comet). Following screen can give you little idea about the http (<a title="AJAX Introduction" href="http://en.wikipedia.org/wiki/Ajax_(programming)" rel="nofollow">XHR</a>) requests made from JQuery .</p>
<div id="attachment_2849" class="wp-caption aligncenter" style="width: 584px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/05/Firebug-Tool-Debugging-Streaming-API-of-Salesforce.png"><img class=" wp-image-2849   " title="Firebug Tool - Debugging Streaming API of Salesforce" src="http://shivasoft.in/blog/wp-content/uploads/2012/05/Firebug-Tool-Debugging-Streaming-API-of-Salesforce-1024x310.png" alt="Firebug Tool - Debugging Streaming API of Salesforce" width="574" height="174" /></a><p class="wp-caption-text">Firebug Tool - Debugging Streaming API of Salesforce</p></div>
<p><a href="http://shivasoft.in/blog/wp-content/uploads/2012/05/StreaminAPI.zip">Download Static Resource used in this article for Streaming API example of salesforce</a></p>
<p><strong>Output Video of Streaming API:</strong></p>
<p><iframe src="http://www.youtube.com/embed/wDLdXLee43U" frameborder="0" width="560" height="315"></iframe></p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/others/tips/streaming-api-using-jquery-salesforce/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Salesforce Apex Code talk &#8211; Important Questions and Answers</title>
		<link>http://shivasoft.in/blog/salesforce/salesforce-apex-code-talk-important-questions-and-answers/</link>
		<comments>http://shivasoft.in/blog/salesforce/salesforce-apex-code-talk-important-questions-and-answers/#comments</comments>
		<pubDate>Thu, 03 May 2012 06:10:49 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Force.com]]></category>
		<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Visualforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2835</guid>
		<description><![CDATA[Salesforce Apex Code talk on - 24-April-2012 , Important Interview Questions
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/' rel='bookmark' title='Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex'>Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/' rel='bookmark' title='Dynamic Approval Process in Salesforce based on the Apex and Trigger'>Dynamic Approval Process in Salesforce based on the Apex and Trigger</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 5'>Salesforce Interview Questions &#8211; Part 5</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Hello everyone,<br />
On 24th April 2012, There was Apex code chat conducted by the Salesforce. So i thought to share important question and answers of that chat. <a title="Salesforce Chat" href="http://wiki.developerforce.com/page/CodeTalk:_Apex_(2012-Apr)" rel="nofollow">You can read complete chat here</a>.</p>
<hr />
<p>Here are some of the (edited) highlights from this episode&#8217;s chat transcript.</p>
<p><strong>Question:</strong> Is there a way in Apex to send an email and replace the default from email address (no-reply@salesforce.com)?<br />
<strong>Ans:</strong> Yes, using either the setSenderDisplayName or setOrgWideEmailAddressID methods on the SingleEmailMessage or MassEmailMessage classes.</p>
<hr />
<p><strong>Question:</strong> Which fields are accessible in a Trigger.new record without performing a SOQL query? For example if my trigger is on the Contact object, are fields on the parent Account object (like Account Description) accessible without performing an explicit SOQL query?<br />
<strong>Ans:</strong> You can use Trigger.new to access all non-null fields of the object on which the trigger is defined. You have to perform an explicit SOQL query to access any fields on associated parent or child records. For example, if the trigger is defined on Contact, you can only access the Id of the parent Account record (via AccountId) in Trigger.new. You&#8217;d need to perform a separate SOQL query to access any other field on the parent Acccount record (e.g. Description, Industry etc.).<span id="more-2835"></span></p>
<hr />
<p><strong>Question:</strong> Does Apex support JavaDoc style documentation?<br />
<strong>Ans:</strong>Apex does not natively support generating JavaDoc style documentation. However, the Force.com developer community has created an open-source tool to support this. <a title="Salesforce JavaDoc Style" href="http://techsahre.blogspot.com/2011/01/apexdoc-salesforce-code-documentation.html" rel="nofollow">More details can be found here</a>.</p>
<hr />
<p><strong>Question:</strong> Is there any advantage to having just one &#8220;master&#8221; trigger per object, or should we have separate triggers for each functional requirement?<br />
<strong>Ans:</strong>There is no hard or fast rule in the one vs many triggers per object debate. A lot depends on the specific use case and how you prefer to organize your code. Having a single &#8216;master&#8217; trigger per object can help enforce order of code execution. Having all code in a single trigger can also be an appealing way to organize code. However, having separate triggers enforce different business requirements may increase code maintainability for some.</p>
<hr />
<p><strong>Question:</strong> How can I return random records in a SOQL query (e.g for testing purposes)?<br />
<strong>Ans:</strong> The easy option would be to perform a SOQL query without a WITH or ORDER BY clause. A more advanced option would be to use a combination of SOQL OFFSET and Math.random() as described<a title="StackOverflow Thread" href="http://stackoverflow.com/questions/4408814/how-do-i-request-a-single-random-row-from-a-force-com-database-in-soql/10302018#10302018" rel="nofollow"> in this Stackoverflow thread</a>.</p>
<hr />
<p><strong>Question:</strong>  Can we use Facebook credentials to log into a Customer Portal?<br />
<strong>Ans:</strong>Yes &#8211; using the new Authentication Providers feature in Spring &#8217;12. For more details, <a title="Webinar Video" href="http://wiki.developerforce.com/page/Webinar:Social_Sign-On_with_Authentication_Providers_(2012-Apr)" rel="nofollow">check out this webinar recording</a>.</p>
<hr />
<p><strong>Question:</strong>  Can we integrate Google Calender with the Salesforce Calender?<br />
<strong>Ans:</strong>You can use<a title="Google Toolkit" href="http://code.google.com/p/apex-google-data/" rel="nofollow"> this Google Data toolkit</a> to implement a custom integration between Google Calendar and Salesforce.</p>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/' rel='bookmark' title='Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex'>Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/' rel='bookmark' title='Dynamic Approval Process in Salesforce based on the Apex and Trigger'>Dynamic Approval Process in Salesforce based on the Apex and Trigger</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 5'>Salesforce Interview Questions &#8211; Part 5</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/salesforce-apex-code-talk-important-questions-and-answers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Salesforce Interview Questions &#8211; Part 7</title>
		<link>http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-7/</link>
		<comments>http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-7/#comments</comments>
		<pubDate>Mon, 23 Apr 2012 12:08:04 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Salesforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2825</guid>
		<description><![CDATA[Basic concepts and Interview Questions of salesforce, Visualforce, Apex and SOQL
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 6'>Salesforce Interview Questions &#8211; Part 6</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 5'>Salesforce Interview Questions &#8211; Part 5</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-%e2%80%93-part-3/' rel='bookmark' title='Salesforce Interview Questions – Part 3'>Salesforce Interview Questions – Part 3</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; padding-bottom: 10px; margin-top: 10px; color: #140b5c;">
<p><a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 1" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions/" target="_blank"> Part &#8211; 1</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 2" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions-%E2%80%93-part-2/" target="_blank">Part &#8211; 2</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 3" href="http://shivasoft.in/blog/tips/salesforce-interview-questions-%E2%80%93-part-3/" target="_blank"> Part &#8211; 3</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 4 - Dynamic Apex" href="http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/" target="_blank">Part &#8211; 4 &#8211; Dynamic Apex</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 5" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/" target="_blank">Part &#8211; 5 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 6" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/" target="_blank">Part &#8211; 6 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 7" href="http://shivasoft.in/blog/?p=2825" target="_blank">Part &#8211; 7 </a></p>
<p><a style="color: #140b5c !important;" title="Salesforce Certification Mock Test" href="http://www.shivasoft.in/quiz/index.php" target="_blank"> Salesforce Certification Mock Test </a></p>
</div>
<p><strong>61. How to round the double to two decimal places in Apex?<br />
Ans:</strong></p>
<pre class="brush: java; title: ; notranslate">
Decimal d = 100/3;
Double ans = d.setScale(2) ;
</pre>
<hr />
<p><strong>62.In Profile settings, what is difference between &#8220;Modify All Data&#8221; and &#8220;Modify All&#8221; ?<br />
Ans:</strong><br />
<strong>Modify All Data :</strong> Create, edit, and delete all organization data, regardless of sharing settings.<br />
<strong>Modify All :</strong> Give All (Read, Create, Add, Delete) permission to selected Object.<span id="more-2825"></span></p>
<hr />
<p><strong>63. If i want record level access then what should i use from Salesforce security model?<br />
Ans:</strong> Manual Sharing</p>
<hr />
<p><strong>63. If i want Object level access then what should i use from Salesforce security model?<br />
Ans:</strong> Profile</p>
<hr />
<p><strong>64. In OWD (Organization wide sharing), can i change the setting &#8220;Grant Access Using Hierarchies&#8221; for Standard Objects ?<br />
Ans:</strong> You cannot change it for Standard Objects However for Custom Objects its possible.</p>
<hr />
<p><strong>65. What is Mandatory while creating User, Role or Profile?<br />
Ans :</strong> Its Profile.</p>
<hr />
<p><strong>66. In case of Master-Detail relationship, on Update of master record can we update the field of child record using workflow rule?<br />
Ans:</strong> No</p>
<hr />
<p><strong>67. In case of Master-Detail relationship, on Update of child record can we update the field of Parent record using workflow rule?<br />
Ans:</strong> Yes, the Master fields are also available for &#8220;Criteria evaluation&#8221;.</p>
<p><strong>68. While setting OWD (Organization wide sharing), can we change/modify the setting of child record in case of Master-Detail relationship?<br />
Ans:</strong> No, Child record is controlled by the Parents setting.</p>
<hr />
<p><strong>69. What is the need of &#8220;Custom Controller&#8221; in Visualforce as everything can be done by the combination of Standard Controller + Extension class.<br />
Ans : </strong></p>
<ul>
<li>Sharing setting is applied on standard object/extension by default; In case we don&#8217;t want to apply sharing setting in our code then Custom controller is only option.</li>
<li>It is possible that the functionality of page does not required any Standard object or may require more than one standard object, then in that case Custom controller is required.</li>
</ul>
<hr />
<p><strong>70. In class declaration if we don&#8217;t write keyword &#8220;with sharing&#8221; then it runs in system mode then why keyword &#8220;without sharing&#8221; is introduced in apex?<br />
Ans:</strong><br />
Lets take example, there is <strong>classA</strong> declared using &#8220;<strong>with sharing</strong>&#8221; and it calls <strong>classB</strong> method. classB is not declared with any keyword then by default &#8220;with sharing&#8221; will be applied to that class because originating call is done through classA. To avoid this we have to explicitly define classB with keyword &#8220;without sharing&#8221;.</p>
<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; padding-bottom: 10px; margin-top: 10px; color: #140b5c;">
<p><a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 1" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions/" target="_blank"> Part &#8211; 1</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 2" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions-%E2%80%93-part-2/" target="_blank">Part &#8211; 2</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 3" href="http://shivasoft.in/blog/tips/salesforce-interview-questions-%E2%80%93-part-3/" target="_blank"> Part &#8211; 3</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 4 - Dynamic Apex" href="http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/" target="_blank">Part &#8211; 4 &#8211; Dynamic Apex</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 5" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/" target="_blank">Part &#8211; 5 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 6" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/" target="_blank">Part &#8211; 6 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 7" href="http://shivasoft.in/blog/?p=2825" target="_blank">Part &#8211; 7 </a></p>
<p><a style="color: #140b5c !important;" title="Salesforce Certification Mock Test" href="http://www.shivasoft.in/quiz/index.php" target="_blank"> Salesforce Certification Mock Test </a></p>
</div>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 6'>Salesforce Interview Questions &#8211; Part 6</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 5'>Salesforce Interview Questions &#8211; Part 5</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-%e2%80%93-part-3/' rel='bookmark' title='Salesforce Interview Questions – Part 3'>Salesforce Interview Questions – Part 3</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Gantt Chart in Salesforce using JQuery and JSON</title>
		<link>http://shivasoft.in/blog/salesforce/gantt-chart-in-salesforce-using-jquery-and-json/</link>
		<comments>http://shivasoft.in/blog/salesforce/gantt-chart-in-salesforce-using-jquery-and-json/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 19:30:40 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[JQuery]]></category>
		<category><![CDATA[JSON]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2817</guid>
		<description><![CDATA[Tutorial and Example of creating the Gantt Chart in Salesforce using JQuery and JSON
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/creating-json-parser-using-jquery/' rel='bookmark' title='Creating JSON Parser Using JQuery'>Creating JSON Parser Using JQuery</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/json-output-in-visualforce/' rel='bookmark' title='JSON output in Visualforce'>JSON output in Visualforce</a></li>
<li><a href='http://shivasoft.in/blog/others/tips/streaming-api-using-jquery-salesforce/' rel='bookmark' title='Streaming API Using JQuery &#8211; Salesforce'>Streaming API Using JQuery &#8211; Salesforce</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>I have searched a lot for any library available for the Gantt Chart however there are very few available on the web. Even i was not able to find out the chart in &#8220;Google API&#8221;.</p>
<p>In this article, i will delineate creating the &#8220;<strong>Gantt Chart</strong>&#8221; using JQuery and JSON. In <strong><a title="JSON output in Salesforce" href="http://shivasoft.in/blog/salesforce/json-output-in-visualforce/">previous article</a></strong> we have seen that how to generate JSON using Salesforce. So continuing the last article, i will use the same JSON reponse to create the &#8220;Gantt Chart&#8221;.</p>
<p><strong>What is Gantt Chart?</strong></p>
<p>A Gantt chart is a type of bar chart, developed by Henry Gantt, that illustrates a project schedule. Gantt charts illustrate the start and finish dates of the terminal elements and summary elements of a project.</p>
<p>In this example i am going to create the Gantt Chart for room reservation system. for this i am going to use the <a title="JQuery Plugin for Gantt Chart" href="http://mbielanczuk.com/?page_id=368">JQuery plugin for creating Gantt Chart found here</a>.</p>
<p>Plugin uses following JSON format :</p>
<pre class="brush: jscript; title: ; notranslate">
[{  &quot;name&quot;  : &quot;Task#1&quot;
  , &quot;desc&quot;  : &quot; Task Desc&quot;
  , &quot;values&quot;: [
      {  &quot;from&quot;       : &quot;/Date(1296547200000)/&quot;
       , &quot;to&quot;         : &quot;/Date(1296554400000)/&quot;
       , &quot;desc&quot;       : &quot;&lt;b&gt;Task #1&lt;br&gt;&quot;
       , &quot;customClass&quot;: &quot;ganttRed&quot; (optional)
       , &quot;label&quot;      : &quot;Task #1&quot; (optional)
      },
      {  &quot;from&quot;       : &quot;/Date(1296637200000)/&quot;
       , &quot;to&quot;         : &quot;/Date(1296649800000)/&quot;
       , &quot;desc&quot;: &quot;&lt;b&gt;Task #&lt;/b&gt;&quot;
       , &quot;customClass&quot;: &quot;ganttOrange&quot; (optional)
       , &quot;label&quot;: &quot;Task #1&quot; (optional)
      }
  ]
 },
 ...
]
</pre>
<p>However we know that the variable name &#8220;from&#8221; and &#8220;desc&#8221; are not valid in Apex because they are keyword. so as a workaround i am replacing the placeholders after the generation of JSON in previous article.<span id="more-2817"></span></p>
<p>I have added the <strong>Static Resource</strong> of name &#8220;GanttChart&#8221; which includes the jQuery and jQuery plugin to draw the Gantt Chart.</p>
<p><a href="http://shivasoft.in/blog/wp-content/uploads/2012/04/Gantt-Chart-Code.zip">Download Complete Source code for Gantt Chart in Salesforce with Static resources</a></p>
<p>following visualforce page renders the Grantt chart on the basis of JSON passed:</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;apex:page standardStylesheets=&quot;false&quot; sidebar=&quot;false&quot;&gt;

&lt;apex:stylesheet value=&quot;{!URLFOR($Resource.GanttChart, 'style.css')}&quot;/&gt;
&lt;apex:includeScript value=&quot;{!URLFOR($Resource.GanttChart, 'js/jquery-1.5.1.min.js')}&quot;/&gt;
&lt;apex:includeScript value=&quot;{!URLFOR($Resource.GanttChart, 'js/jquery.fn.gantt.js')}&quot;/&gt;

&lt;div class=&quot;gantt&quot; /&gt;

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

$gc = jQuery.noConflict();

function getHostName()
{
    var p = $gc(location).attr('href');
    pathArray = p.split( '/' );
    var protocol = pathArray[0];
    var host = pathArray[2];
    return protocol+'//'+host;
}

	var jsonDataURL = getHostName()+'/apex/GanttChartData?core.apexpages.devmode.url=0';

	$gc(function () {
     	$gc(&quot;.gantt&quot;).gantt({source: jsonDataURL, navigate: 'scroll', scale: 'hours', maxScale: 'hours', minScale: 'hours', hollydays: [&quot;\/Date(1293836400000)\/&quot;]});
     });

&lt;/script&gt;

&lt;/apex:page&gt;
</pre>
<p>Gantt Chart will be rendered in div tag having class name as &#8220;<strong>gantt</strong>&#8220;.</p>
<p>Note : We have to Remember one thing that the Date must be passed in format of &#8220;\/Date(VALUE_IN_MIL_SECOND)\/&#8221; because regular expression is used by the plugin to identify and convert back date to javascript format.</p>
<p>Refer <a title="Salesforce Date time methods" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_datetime.htm">this API for Datetime methods of the Salesforce</a></p>
<p>The output will look like:</p>
<div id="attachment_2818" class="wp-caption aligncenter" style="width: 598px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/04/Gantt-Chart-in-Salesforce.png"><img class=" wp-image-2818 " title="Gantt Chart in Salesforce" src="http://shivasoft.in/blog/wp-content/uploads/2012/04/Gantt-Chart-in-Salesforce.png" alt="Gantt Chart in Salesforce" width="588" height="199" /></a><p class="wp-caption-text">Gantt Chart in Salesforce</p></div>
<p><a href="http://shivasoft.in/blog/wp-content/uploads/2012/04/Gantt-Chart-Code.zip">Download Complete Source code for Gantt Chart in Salesforce with Static resources</a></p>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/creating-json-parser-using-jquery/' rel='bookmark' title='Creating JSON Parser Using JQuery'>Creating JSON Parser Using JQuery</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/json-output-in-visualforce/' rel='bookmark' title='JSON output in Visualforce'>JSON output in Visualforce</a></li>
<li><a href='http://shivasoft.in/blog/others/tips/streaming-api-using-jquery-salesforce/' rel='bookmark' title='Streaming API Using JQuery &#8211; Salesforce'>Streaming API Using JQuery &#8211; Salesforce</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/gantt-chart-in-salesforce-using-jquery-and-json/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>JSON output in Visualforce</title>
		<link>http://shivasoft.in/blog/salesforce/json-output-in-visualforce/</link>
		<comments>http://shivasoft.in/blog/salesforce/json-output-in-visualforce/#comments</comments>
		<pubDate>Tue, 17 Apr 2012 18:40:31 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[JSON]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2808</guid>
		<description><![CDATA[The Example of generating the JSON Output in Visualforce page using JSON.serialize method provided by Salesforce
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/gantt-chart-in-salesforce-using-jquery-and-json/' rel='bookmark' title='Gantt Chart in Salesforce using JQuery and JSON'>Gantt Chart in Salesforce using JQuery and JSON</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/one-visualforce-page-as-an-iframe-in-another-visualforce-page-salesforce-com/' rel='bookmark' title='One visualforce page as an iframe in another visualforce page &#8211; Salesforce.com'>One visualforce page as an iframe in another visualforce page &#8211; Salesforce.com</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/passing-parameter-in-actionfunction-in-visualforce/' rel='bookmark' title='Passing multiple Parameters in ActionFunction in Visualforce'>Passing multiple Parameters in ActionFunction in Visualforce</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In this article, i will demonstrate using the JSON.serialize() method provided by the Salesforce to convert the class into equivalent JSON String.</p>
<p>Before going into depth would like to explain the basic concept of JSON syntax for the newbie.</p>
<p>There are following thumb rules i have identified from my experience, please comment in this article if i miss something here:</p>
<ul>
<li>The JSON stands for &#8220;<strong>Java Script Object Notation</strong>&#8220;.</li>
<li>JSON is used widely as an option to xml, because the xml is very verbose whereas the JSON is having very simple representation.</li>
<li>It Simply have a key and value pair combination.</li>
<li>DataTypes supported by the JSON are &#8220;Number, String, Boolean, Array, Object and null&#8221;.</li>
<li>Key and value pair are separated by colon &#8220;:&#8221;</li>
<li>Object is enclosed between curly brackets &#8220;{&#8221; and &#8220;}&#8221;.</li>
<li>Array is enclosed using square bracket &#8220;[", "]&#8221; separated by the comma.</li>
</ul>
<p>Example of JSON syntax:</p>
<pre class="brush: jscript; title: ; notranslate">
{
     &quot;firstName&quot;: &quot;Jitendra&quot;,
     &quot;lastName&quot; : &quot;Zaa&quot;,
     &quot;age&quot;      : 26,
     &quot;address&quot;  :
     {
         &quot;streetAddress&quot;: &quot;21 2nd Street&quot;,
         &quot;city&quot;         : &quot;Nagpur&quot;,
         &quot;state&quot;        : &quot;MH&quot;,
         &quot;postalCode&quot;   : &quot;400008&quot;
     },
     &quot;phoneNumber&quot;:
     [
         {
           &quot;type&quot;  : &quot;Mobile&quot;,
           &quot;number&quot;: &quot;212 555-1234&quot;
         },
         {
           &quot;type&quot;  : &quot;Home&quot;,
           &quot;number&quot;: &quot;646 555-4567&quot;
         }
     ]
 }
</pre>
<p><a href="http://shivasoft.in/blog/wp-content/uploads/2012/04/VF-as-JSON.zip">Download Source code &#8211; Visualforce page as JSON</a><br />
<span id="more-2808"></span></p>
<p>Now i hope that you must have got some starting information regarding the JSON syntax.<br />
I am taking example of room reservation system and going to create classes in Apex and then convert all into equivalent JSON code. Following is the structure of class i need for this demo.</p>
<ul>
<li>ReservationDetail (This class will have information like start and end time of room, description and label)</li>
<li>Room (This class have room and list of above class as one room can be booked by multiple users).</li>
</ul>
<p>Refer <a title="JSON API - Salesforce" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_json.htm">Salesforce &#8211; JSON API</a></p>
<p>Below is the complete code of the Apex class to generate the JSON.</p>
<pre class="brush: java; title: ; notranslate">
/**
	Author - Jitendra Zaa
	This controller class is used by the VF page &quot;GanttChartData&quot; to generate the JSON
*/
public with sharing class GanttChartData {

	public String jsonString {get;set;}

	//Constructor
	public GanttChartData()
	{
		jsonString = prepareData();

	}
	//Temp Method to prepare the Data
	private String prepareData()
	{
		List&lt;ReservationDetail&gt; dtlObj = new List&lt;ReservationDetail&gt;();

		ReservationDetail obj1 = new ReservationDetail();
		ReservationDetail obj2 = new ReservationDetail();
		ReservationDetail obj3 = new ReservationDetail();

		obj1.setFromDate(String.valueOf(datetime.newInstanceGmt(2012,04, 17, 0, 0, 0).getTime()));
		obj1.setToDate(String.valueOf(datetime.newInstanceGmt(2012,04, 17, 05, 30, 0).getTime()));
		obj1.desc_PH = 'Booked by : Jitendra &lt;br /&gt; for JQuery Demo';
		obj1.label = 'Jitendra';
		obj1.customClass = 'ganttRed';

		obj2.setFromDate(String.valueOf(datetime.newInstanceGmt(2012,04, 17, 20, 30, 0).getTime()));
		obj2.setToDate(String.valueOf(datetime.newInstanceGmt(2012,04, 17, 23, 30, 2).getTime()));
		obj2.desc_PH = 'Booked by : Tuiya &lt;br /&gt; for Wireless Lecture';
		obj2.label = 'Tuiya';
		obj2.customClass = 'ganttOrange';

		obj3.setFromDate(String.valueOf(datetime.newInstanceGmt(2012,04, 19, 09, 30, 0).getTime()));
		obj3.setToDate(String.valueOf(datetime.newInstanceGmt(2012,04, 19, 16, 30, 2).getTime()));
		obj3.desc_PH = 'Booked by : Santosh &lt;br /&gt; for SAP Basis';
		obj3.label = 'Santosh';
		obj3.customClass = 'ganttGreen';

		dtlObj.add(obj1);
		dtlObj.add(obj2);
		dtlObj.add(obj3);

		Room r = new Room();
		r.name = 'Training Room';
		r.desc_PH = 'This is Training Room';
		r.values = dtlObj;

		List&lt;Room&gt; r1 = new List&lt;Room&gt;();
		r1.add(r);

		return JSON.serialize(r1);
	}
	public class RoomList
	{
		public List&lt;Room&gt; rooms;
	}
	public class Room
	{
		public String name{get;set;}
		//Below var name - desc
		public String desc_PH{get;set;}
		public List&lt;ReservationDetail&gt; values{get;set;}
	}

	public class ReservationDetail
	{
		//actual variable name needed was &quot;from&quot;, but it is keyword so we cant use that
		public String frm_PH{get;set;}
		public String to{get;set;}

		public String desc_PH{get;set;}
		public String label{get;set;}

		/*
			Custom class Can be anything from below:
			ganttRed
			ganttGreen
			ganttOrange

		*/
		public String customClass{get;set;}

		public void setToDate(String val)
		{
			to = setDate(val);
		}
		public void setFromDate(String val)
		{
			frm_PH = setDate(val);
		}
		//Date should be in special format as it is used in regular expression
		private String setDate(String val)
		{
			return '/Date('+val+')/';
		}
	}
}
</pre>
<p>As you can see in above code that i am using method &#8220;<strong>JSON.serialize(Object)</strong>&#8221; to convert the class into JSON. the variable name will be converted as a key.</p>
<p>In above code some extra logic is also added like formatting Date data, there is no need of this.</p>
<p><strong>Output Visualforce page as JSON Data:</strong></p>
<p>To output the Visualforce page as JSON Data following point needs to be taken care,</p>
<ol>
<li><strong>contentType</strong> should be &#8220;application/x-JavaScript; charset=utf-8&#8243; (Note that i have not specified it as json although valid MIME type available for JSON in HTML)</li>
<li><strong>showHeader</strong> attribute should be false.</li>
<li><strong>standardStylesheets</strong> attribute should be false.</li>
<li><strong>sidebar</strong> attribute should be false.</li>
<li>While calling the VF page always specify explicitly that we don&#8217;t need Page editor tool of the Salesforce using <strong>core.apexpages.devmode.url=0.</strong></li>
</ol>
<p>Source code for VF:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:page controller=&quot;GanttChartData&quot;  contentType=&quot;application/x-JavaScript; charset=utf-8&quot; showHeader=&quot;false&quot; standardStylesheets=&quot;false&quot; sidebar=&quot;false&quot;&gt;
{!jsonString}
&lt;/apex:page&gt;
</pre>
<p>The output of the above code is:</p>
<div id="attachment_2810" class="wp-caption aligncenter" style="width: 576px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/04/Visualforce-page-output-as-JSON.png"><img class=" wp-image-2810 " title="Visualforce page output as JSON" src="http://shivasoft.in/blog/wp-content/uploads/2012/04/Visualforce-page-output-as-JSON.png" alt="Visualforce page output as JSON" width="566" height="445" /></a><p class="wp-caption-text">Visualforce page output as JSON</p></div>
<p><a href="http://shivasoft.in/blog/wp-content/uploads/2012/04/VF-as-JSON.zip">Download Source code &#8211; Visualforce page as JSON</a></p>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/gantt-chart-in-salesforce-using-jquery-and-json/' rel='bookmark' title='Gantt Chart in Salesforce using JQuery and JSON'>Gantt Chart in Salesforce using JQuery and JSON</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/one-visualforce-page-as-an-iframe-in-another-visualforce-page-salesforce-com/' rel='bookmark' title='One visualforce page as an iframe in another visualforce page &#8211; Salesforce.com'>One visualforce page as an iframe in another visualforce page &#8211; Salesforce.com</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/passing-parameter-in-actionfunction-in-visualforce/' rel='bookmark' title='Passing multiple Parameters in ActionFunction in Visualforce'>Passing multiple Parameters in ActionFunction in Visualforce</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/json-output-in-visualforce/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Creating Trigger on Attachment in Salesforce</title>
		<link>http://shivasoft.in/blog/salesforce/creating-trigger-on-attachment-in-salesforce/</link>
		<comments>http://shivasoft.in/blog/salesforce/creating-trigger-on-attachment-in-salesforce/#comments</comments>
		<pubDate>Wed, 28 Mar 2012 16:57:09 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Trigger]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2797</guid>
		<description><![CDATA[Example and tutorial on creating the trigger for attachment in salesforce which will not allow to upload the file in opportunity if file contains some predefined text
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-%e2%80%93-creating-trigger-and-test-cases-%e2%80%93-6-of-6/' rel='bookmark' title='Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6'>Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/' rel='bookmark' title='Dynamic Approval Process in Salesforce based on the Apex and Trigger'>Dynamic Approval Process in Salesforce based on the Apex and Trigger</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-creating-custom-object-1-of-n/' rel='bookmark' title='Step by Step Salesforce Tutorial – Creating custom object – 1 of 6'>Step by Step Salesforce Tutorial – Creating custom object – 1 of 6</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Lots of time i have seen the question on salesforce developer forum regarding the trigger on Attachment. As this is not a straightway, still we can have trigger on Attachment.</p>
<p>We cannot create trigger on Attachment from the standard salesforce UI however we will have to use the eclipse.</p>
<div id="attachment_2798" class="wp-caption aligncenter" style="width: 543px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/Before-insert-Trigger-on-Attachment-Salesforce.png"><img class="size-full wp-image-2798" title="Before insert Trigger on Attachment using eclipse in Salesforce" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/Before-insert-Trigger-on-Attachment-Salesforce.png" alt="Before insert Trigger on Attachment using eclipse in Salesforce" width="533" height="510" /></a><p class="wp-caption-text">Before insert Trigger on Attachment using eclipse in Salesforce</p></div>
<p style="text-align: justify;">While creating the trigger, we have to keep some important points. We should be very careful while writing the trigger on Attachment, as it will be used by any standard or custom Object and therefore the criteria to run trigger for &#8220;particular object only&#8221; must be handled carefully.<span id="more-2797"></span></p>
<p style="text-align: justify;">In this article i will create the trigger which will check for the parent object &#8220;Opportunity&#8221;. If the object is opportunity then it will check let say for the file name cannot contain word &#8220;shivasoft&#8221;.</p>
<pre class="brush: java; title: ; notranslate">
trigger CheckAttachmentName on Attachment (before insert) {
	for (Attachment att:Trigger.new)
	{
		String parentObjId = att.ParentId;
		//006 is the starting sting in ID for all opportunities
		if(parentObjId.startsWith('006') &amp;&amp; att.Name.toLowerCase().contains('shivasoft'))
		{
				att.addError('Cannot upload file with name containing - shivasoft');
		}
	}

	//This method will return true if the id belongs to Opportunity
	private Boolean isOpportunityParent(String id)
	{
		for(Opportunity opp : [SELECT Id FROM Opportunity WHERE Id = :id])
		{
			return true;
		}
		return false;
	}
}
</pre>
<p>In the above code, we are checking that the Parent id starts with &#8220;006&#8243; or not. As starting three characters in ID identifies the type of the object.</p>
<p><strong>Alternate solution &#8211; Not recommended :</strong><br />
There is one method created named &#8220;isOpportunityParent&#8221; which uses the SOQL approach but it is not recommended and may cause SOQL limit exception in bulk processing. We can supply the list of Id in method and return the Map which will contain ParentId as Key and Boolean as value identifying that the particular id belongs to opportunity or not?</p>
<div id="attachment_2800" class="wp-caption aligncenter" style="width: 477px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/Error-Message-on-Attachment-using-Trigger-in-Salesforce.png"><img class="size-full wp-image-2800" title="Error Message on Attachment using Trigger in Salesforce" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/Error-Message-on-Attachment-using-Trigger-in-Salesforce.png" alt="Error Message on Attachment using Trigger in Salesforce" width="467" height="356" /></a><p class="wp-caption-text">Error Message on Attachment using Trigger in Salesforce</p></div>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-%e2%80%93-creating-trigger-and-test-cases-%e2%80%93-6-of-6/' rel='bookmark' title='Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6'>Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/' rel='bookmark' title='Dynamic Approval Process in Salesforce based on the Apex and Trigger'>Dynamic Approval Process in Salesforce based on the Apex and Trigger</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-creating-custom-object-1-of-n/' rel='bookmark' title='Step by Step Salesforce Tutorial – Creating custom object – 1 of 6'>Step by Step Salesforce Tutorial – Creating custom object – 1 of 6</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/creating-trigger-on-attachment-in-salesforce/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Dynamic Approval Process in Salesforce based on the Apex and Trigger</title>
		<link>http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/</link>
		<comments>http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/#comments</comments>
		<pubDate>Mon, 26 Mar 2012 18:36:07 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Force.com]]></category>
		<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Trigger]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2783</guid>
		<description><![CDATA[This article explain the Automatic submission of Approval process using Apex and trigger. It include Automatic submission, approval as well as rejection of record completely using Apex and trigger.
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/creating-trigger-on-attachment-in-salesforce/' rel='bookmark' title='Creating Trigger on Attachment in Salesforce'>Creating Trigger on Attachment in Salesforce</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/' rel='bookmark' title='Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex'>Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-%e2%80%93-creating-trigger-and-test-cases-%e2%80%93-6-of-6/' rel='bookmark' title='Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6'>Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Although this is very common approach and lots of articles are around on this topic, still I want to delineate the topic in other way. This topic covers complete scenarios for the approval process based on the Apex class.</p>
<p><strong>Agenda of this article:</strong></p>
<ol>
<li>Automatically submit the record for approval on the basis of field value.</li>
<li>Automatically select the next Approver.</li>
<li>Approve / Reject the record on the basis of field.</li>
</ol>
<p><strong>Assumptions:</strong></p>
<ul>
<li>Opportunity Object is used.</li>
<li>Approval Process is already set on the Opportunity.</li>
<li>Field “Next_Approver” will decide that who is going to approve the record.</li>
<li>There are three steps in the approval process.</li>
<li>There is no test class written and no check for mandatory fields needed for the trigger, as I have considered positive scenarios only.</li>
</ul>
<p><strong>Important URLS:</strong></p>
<p>API of Approval Process classes:</p>
<ol>
<li><a title="ApexProcess Class" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process.htm">http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_process.htm</a></li>
<li><a title="ApexProcessRequest Class" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessRequest.htm">http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessRequest.htm</a></li>
<li><a title="ApexProcessResult Class" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessResult.htm">http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessResult.htm</a></li>
<li><a title="ApexProcessSubmitRequest Class" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessSubmitRequest.htm">http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessSubmitRequest.htm</a></li>
<li><a title="ApexProcessWorkItemRequest Class" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessWorkitemRequest.htm">http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessWorkitemRequest.htm</a></li>
</ol>
<p><strong>Steps of Standard approval process defined:</strong></p>
<div id="attachment_2787" class="wp-caption aligncenter" style="width: 555px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/Approval-Process-Steps.png"><img class=" wp-image-2787 " title="Approval Process Steps" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/Approval-Process-Steps.png" alt="Approval Process Steps" width="545" height="109" /></a><p class="wp-caption-text">Approval Process Steps</p></div>
<p><span id="more-2783"></span></p>
<p>To achieve this, I am going to create the trigger named “AutomateApprove”.</p>
<p><strong>Automatically submit the approval process using trigger – Apex:</strong></p>
<p>Below method is used to automatically submit the approval process using trigger.</p>
<pre class="brush: java; title: ; notranslate">
public void submitForApproval(Opportunity opp)
    {
        // Create an approval request for the Opportunity
        Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval automatically using Trigger');
        req1.setObjectId(opp.id);
        req1.setNextApproverIds(new Id[] {opp.Next_Approver__c});

        // Submit the approval request for the Opportunity
        Approval.ProcessResult result = Approval.process(req1);

    }
</pre>
<p>Class “<a title="API Class reference" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessSubmitRequest.htm">ProcessSubmitRequest</a>” is used to automatically submit the approval process. We need to set following items while submitting the approval process using trigger:</p>
<ul>
<li>Comment</li>
<li>TargetObjectId</li>
<li>NextApproverIds – if needed. Here Custom logic can be written to dynamically set approver for approval process. In this case I am using the custom field present on the Opportunity.</li>
</ul>
<p><strong>Automatically approve the approval process using trigger – Apex:</strong></p>
<p>Below method is used to automatically approve the approval process using trigger.</p>
<pre class="brush: java; title: ; notranslate">
/*
    * This method will Approve the opportunity
    */
    public void approveRecord(Opportunity opp)
    {
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Approving request using Trigger');
        req.setAction('Approve');
        req.setNextApproverIds(new Id[] {opp.Next_Approver__c});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);

        if(workItemId == null)
        {
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else
        {
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }
</pre>
<p>Class “<a title="API Class Reference" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessWorkitemRequest.htm">ProcessWorkitemRequest</a>” is used to automatically approve the approval process. We need to set following items while submitting the approval process using trigger:</p>
<ul>
<li>Comment</li>
<li>TargetObjectId</li>
<li>NextApproverIds – if needed</li>
<li>WorkItemId – Custom code required to get this</li>
</ul>
<p><strong>Get the WorkItemId for the pending approval process of the Object:</strong><br />
This is the tricky part, if the Submission and approval of the record is done in single code block then it’s very easy to get the WorkItemId of the needed process.</p>
<p><strong>Here the standard code snap provided:</strong></p>
<p>After Submission the approval process using Apex we get the object of class “<a title="API Class Reference" href="http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_ProcessResult.htm">ProcessResult</a>”.</p>
<pre class="brush: java; title: ; notranslate">
Approval.ProcessResult result = Approval.process(req1);
</pre>
<p>And from the class we can get workitemid as :</p>
<pre class="brush: java; title: ; notranslate">
List&lt;Id&gt; newWorkItemIds = result.getNewWorkitemIds();
</pre>
<p>And set the id like:</p>
<pre class="brush: java; title: ; notranslate">
req2.setWorkitemId(newWorkItemIds.get(0));
</pre>
<p><strong>Other method to get the “WorkItemId” :</strong><br />
The above code was not usable in our scenario as the submission and approval or rejection was done at different level. So I have created following utility method to get the WorkitemId of the supplied Object’s id. Here I have considered that only one workitem will present.</p>
<pre class="brush: java; title: ; notranslate">
public Id getWorkItemId(Id targetObjectId)
    {
        Id retVal = null;

        for(ProcessInstanceWorkitem workItem  : [Select p.Id from ProcessInstanceWorkitem p
            where p.ProcessInstance.TargetObjectId =: targetObjectId])
        {
            retVal  =  workItem.Id;
        }

        return retVal;
    }
</pre>
<p>As you can see, we need to query the object “<strong>ProcessInstanceWorkitem</strong>” to get workitemId of the object.</p>
<p><strong>Automatically reject the approval process using trigger – Apex:</strong><br />
Following code is used to reject the approval process using code.</p>
<pre class="brush: java; title: ; notranslate">
public void rejectRecord(Opportunity opp)
    {
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Rejected request using Trigger');
        req.setAction('Reject');
        //req.setNextApproverIds(new Id[] {UserInfo.getUserId()});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);

        if(workItemId == null)
        {
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else
        {
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }
</pre>
<p><strong>Execution of Approval process using Apex and trigger:</strong></p>
<div id="attachment_2790" class="wp-caption aligncenter" style="width: 665px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/Approval-Process-Log-After-Execution.png"><img class=" wp-image-2790  " title="Approval Process Log After Execution" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/Approval-Process-Log-After-Execution-1024x215.png" alt="Approval Process Log After Execution" width="655" height="138" /></a><p class="wp-caption-text">Approval Process Log After Execution</p></div>
<p><strong>Complete code:</strong></p>
<pre class="brush: java; title: ; notranslate">
trigger AutomateApprove on Opportunity(After insert, After update)
{

    for (Integer i = 0; i &lt; Trigger.new.size(); i++)
    {
     try
     {
        //Insure that previous value not equal to current, else if there is any field update on approval process action
        //there will be recurrence of the trigger.

        if(Trigger.new[i].Next_Step__c == 'Submit' &amp;&amp; Trigger.old[i].Next_Step__c != 'Submit')
        {
           submitForApproval(Trigger.new[i]);
        }
        else if(Trigger.new[i].Next_Step__c == 'Approve' &amp;&amp; Trigger.old[i].Next_Step__c != 'Approve')
        {
             approveRecord(Trigger.new[i]);
        }
        else if(Trigger.new[i].Next_Step__c == 'Reject' &amp;&amp; Trigger.old[i].Next_Step__c != 'Reject')
        {
             rejectRecord(Trigger.new[i]);
        }
     }catch(Exception e)
     {
         Trigger.new[i].addError(e.getMessage());
     }
    }

    // This method will submit the opportunity automatically
    public void submitForApproval(Opportunity opp)
    {
        // Create an approval request for the Opportunity
        Approval.ProcessSubmitRequest req1 = new Approval.ProcessSubmitRequest();
        req1.setComments('Submitting request for approval automatically using Trigger');
        req1.setObjectId(opp.id);
        req1.setNextApproverIds(new Id[] {opp.Next_Approver__c});

        // Submit the approval request for the Opportunity
        Approval.ProcessResult result = Approval.process(req1);

    }

    //Get ProcessInstanceWorkItemId using SOQL
    public Id getWorkItemId(Id targetObjectId)
    {
        Id retVal = null;

        for(ProcessInstanceWorkitem workItem  : [Select p.Id from ProcessInstanceWorkitem p
            where p.ProcessInstance.TargetObjectId =: targetObjectId])
        {
            retVal  =  workItem.Id;
        }

        return retVal;
    }

    // This method will Approve the opportunity
    public void approveRecord(Opportunity opp)
    {
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Approving request using Trigger');
        req.setAction('Approve');
        req.setNextApproverIds(new Id[] {opp.Next_Approver__c});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);

        if(workItemId == null)
        {
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else
        {
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }

    // This method will Reject the opportunity
    public void rejectRecord(Opportunity opp)
    {
        Approval.ProcessWorkitemRequest req = new Approval.ProcessWorkitemRequest();
        req.setComments('Rejected request using Trigger');
        req.setAction('Reject');
        //req.setNextApproverIds(new Id[] {UserInfo.getUserId()});
        Id workItemId = getWorkItemId(opp.id);
        //opp.addError(workItemId);

        if(workItemId == null)
        {
            opp.addError('Error Occured in Trigger');
            //opp.addError(workItemId);
        }
        else
        {
            req.setWorkitemId(workItemId);
            // Submit the request for approval
            Approval.ProcessResult result =  Approval.process(req);
        }
    }

}
</pre>
<p><strong>Note on possible errors:</strong></p>
<p>1.If you have the “manual Selection of approver” enabled for your approval process/steps then you must specify the approver in the trigger, else you will get an error something like:</p>
<blockquote><p>“System.DmlException: Process failed. First exception on row 0; first error: REQUIRED_FIELD_MISSING, missing required field: []”</p></blockquote>
<p>2.If you set the wrong WorkitemId then may get following error:</p>
<blockquote><p>Process failed. First exception on row 0; first error: INVALID_CROSS_REFERENCE_KEY, invalid cross reference id: []</p></blockquote>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/creating-trigger-on-attachment-in-salesforce/' rel='bookmark' title='Creating Trigger on Attachment in Salesforce'>Creating Trigger on Attachment in Salesforce</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/' rel='bookmark' title='Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex'>Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-%e2%80%93-creating-trigger-and-test-cases-%e2%80%93-6-of-6/' rel='bookmark' title='Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6'>Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Salesforce Interview Questions &#8211; Part 6</title>
		<link>http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/</link>
		<comments>http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/#comments</comments>
		<pubDate>Sat, 10 Mar 2012 10:20:07 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Salesforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2762</guid>
		<description><![CDATA[Basic concepts and Interview Questions of salesforce, Visualforce, Apex and SOQL
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-7/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 7'>Salesforce Interview Questions &#8211; Part 7</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 5'>Salesforce Interview Questions &#8211; Part 5</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 1'>Salesforce Interview Questions &#8211; Part 1</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; padding-bottom: 10px; margin-top: 10px; color: #140b5c;">
<p><a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 1" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions/" target="_blank"> Part &#8211; 1</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 2" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions-%E2%80%93-part-2/" target="_blank">Part &#8211; 2</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 3" href="http://shivasoft.in/blog/tips/salesforce-interview-questions-%E2%80%93-part-3/" target="_blank"> Part &#8211; 3</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 4 - Dynamic Apex" href="http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/" target="_blank">Part &#8211; 4 &#8211; Dynamic Apex</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 5" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/" target="_blank">Part &#8211; 5 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 6" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/" target="_blank">Part &#8211; 6 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 7" href="http://shivasoft.in/blog/?p=2825" target="_blank">Part &#8211; 7 </a></p>
<p><a style="color: #140b5c !important;" title="Salesforce Certification Mock Test" href="http://www.shivasoft.in/quiz/index.php" target="_blank"> Salesforce Certification Mock Test </a></p>
</div>
<p><strong>51. Explain Permission sets released in Winter 12.</strong><br />
<strong>Ans :</strong><br />
A permission set is a collection of settings and permissions that give users access to various tools and functions. The settings and permissions in permission sets are also found in profiles, but <strong>permission sets extend users&#8217; functional access without changing their profiles</strong>. For example, to give users access to a custom object, create a permission set, enable the required permissions for the object, and assign the permission set to the users. You never have to change profiles, or create a profile for a single use case. While users can have only one profile, they can have multiple permission sets.<span id="more-2762"></span></p>
<hr />
<p><strong>52. What is the difference between External ID and Unique ID?<br />
Ans:<br />
External ID</strong><br />
This is a field that usually references an ID from another (external) system. For instance, if the customer has an Oracle Financials system that they will be linking with salesforce.com, it may be easier for them to be able to refer to the Oracle ID of account records from within salesforce. So they would create an external ID in salesforce.com and they would load the Oracle ID into that field for each account. They can then refer to that ID field, rather than the salesforce.com id.</p>
<p>Additionally, if you have an external ID field, the field becomes searchable in the sidebar search. You also can use the upsert API call with the extenal ID to refer to records.</p>
<p>You can have multiple records with the same external ID (though it is not reccomended, as it will defeat the purpose of the external id) .</p>
<p>External Id available for Text, Number and Email field types.</p>
<p>External Id is used in upsert operations.</p>
<ul>
<li>If external id is absenor not matched then insert happens.</li>
<li>If external id matched once then record will be updated.</li>
<li>If external id is matched multiple times then error occurs.</li>
</ul>
<p><strong>Unique ID field</strong></p>
<p>This is a setting for the field that will prevent you from using the same value in multiple records for the unique field. So if I create a 5 character text field and make it unique, and I create a record with the value &#8220;12345&#8243; i will not be able to create another record with that same value in the unique field. If i try to do so, I will get an error saying that the value is already in use.</p>
<p>Often, External Ids are set with the unique property so that the IDs will be unique to each record.</p>
<div id="attachment_2765" class="wp-caption aligncenter" style="width: 638px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/Salesforce-External-Id-option-while-creating-field.png"><img class="size-full wp-image-2765" title="Salesforce - External Id option while creating field" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/Salesforce-External-Id-option-while-creating-field.png" alt="Salesforce - External Id option while creating field" width="628" height="364" /></a><p class="wp-caption-text">Salesforce - External Id option while creating field</p></div>
<hr />
<p><strong>53. How to get the picklist value in Apex class?</strong><br />
<strong> Ans :</strong><br />
Using Dynamic apex, we can achieve this.on object of type pickilist, call <strong>getDescribe()</strong>. then call the <strong>getPicklistValues()</strong> method. iterate over result and create a list. bind it to &lt;apex:selectOptions&gt;.</p>
<hr />
<p><strong>54. What are the types of controller in visual force?<br />
Ans :</strong><br />
There are basically two types of Controller in Visual force page.</p>
<ol>
<li>Standard Controller and</li>
<li>Custom Controller</li>
</ol>
<hr />
<p><strong>55. How many Controllers can be used on single VF page?<br />
Ans :</strong></p>
<p>Only one controller can be used salesforce. Other than them, <strong>Controller extension</strong> can be used. There may be more than one Controller extention.<br />
Example :</p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:page standardController=&quot;Account&quot;
extensions=&quot;ExtOne,ExtTwo&quot; showHeader=&quot;false&quot;&gt;
&lt;apex:outputText value=&quot;{!foo}&quot; /&gt;
&lt;/apex:page&gt;
</pre>
<p>if ExtOne and ExtTwo, both have the method <strong> getFoo()</strong> then the method of ExtOne will be executed.</p>
<p>A controller extension is any Apex class that contains a constructor that takes a single argument of type <strong>ApexPages.StandardController</strong> or <strong>CustomControllerName</strong>, where CustomControllerName is the name of a custom controller that you want to extend.</p>
<hr />
<p><strong>56. Explain System.runAs()<br />
Ans : </strong><br />
Generally, all Apex code runs in system mode, and the permissions and record sharing of the current user are not taken into account. The system method, <strong>System.runAs()</strong>, lets you write test methods that change user contexts to either an existing user or a new user. All of that user&#8217;s record sharing is then enforced. <strong>You can only use runAs in a test method</strong>. The original system context is started again after all runAs() test methods complete.<br />
Example :</p>
<pre class="brush: java; title: ; notranslate">
System.runAs(u) {
// The following code runs as user 'u'
System.debug('Current User: ' + UserInfo.getUserName());
System.debug('Current Profile: ' + UserInfo.getProfileId()); }
// Run some code that checks record sharing
}
</pre>
<hr />
<p><strong>57. Explain Test.setPage().<br />
Ans:</strong><br />
It is used to set the context to current page, normally used for testing the visual force controller.</p>
<hr />
<p><strong>58. What is the custom settings ?<br />
Ans : </strong><br />
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 <strong>exposed in the application cache</strong>, which enables efficient access without the cost of repeated queries to the database. This data can then be used by formula fields, validation rules, Apex, and the Web services API.</p>
<hr />
<p><strong>59. Types of the custom settings?<br />
Ans : </strong><br />
<strong>List Custom Settings</strong><br />
A type of custom setting that provides a reusable set of static data that can be accessed across your organization. If you use a particular set of data frequently within your application, putting that data in a list custom setting streamlines access to it.<strong> Data in list settings does not vary with profile or user, but is available organization-wide</strong>. Examples of list data include two-letter state abbreviations, international dialing prefixes, and catalog numbers for products. Because the data is cached, access is low-cost and efficient: you don&#8217;t have to use SOQL queries that count against your governor limits.</p>
<p><strong>Hierarchy Custom Settings</strong><br />
A type of custom setting that uses a built-in hierarchical logic that lets you “personalize” settings for specific profiles or users. The hierarchy logic checks the organization, profile, and user settings for the current user and returns the most specific, or “lowest,” value. In the hierarchy, settings for an organization are overridden by profile settings, which, in turn, are overridden by user settings.</p>
<hr />
<p><strong>60. Difference between SOSL and SOQL in Salesforce ?<br />
Ans :</strong><br />

<table id="wp-table-reloaded-id-5-no-1" class="wp-table-reloaded wp-table-reloaded-id-5">
<thead>
	<tr class="row-1 odd">
		<th class="column-1">SOSL</th><th class="column-2">SOQL</th>
	</tr>
</thead>
<tbody>
	<tr class="row-2 even">
		<td class="column-1">stands for "Salesforce object search language".</td><td class="column-2">stands for "Salesforce object query language".</td>
	</tr>
	<tr class="row-3 odd">
		<td class="column-1">Works on multiple object at a same time.</td><td class="column-2">Need to write different SOQL for different object.</td>
	</tr>
	<tr class="row-4 even">
		<td class="column-1">All fields are already text indexed.</td><td class="column-2">SOQL against same field will be slow.</td>
	</tr>
	<tr class="row-5 odd">
		<td class="column-1">Cannot used in Triggers. Can only be used in Apex class and anonymous block.</td><td class="column-2">Can be used in Apex class and Triggers.</td>
	</tr>
</tbody>
</table>
</p>
<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; padding-bottom: 10px; margin-top: 10px; color: #140b5c;">
<p><a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 1" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions/" target="_blank"> Part &#8211; 1</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 2" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions-%E2%80%93-part-2/" target="_blank">Part &#8211; 2</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 3" href="http://shivasoft.in/blog/tips/salesforce-interview-questions-%E2%80%93-part-3/" target="_blank"> Part &#8211; 3</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 4 - Dynamic Apex" href="http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/" target="_blank">Part &#8211; 4 &#8211; Dynamic Apex</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 5" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/" target="_blank">Part &#8211; 5 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 6" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/" target="_blank">Part &#8211; 6 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 7" href="http://shivasoft.in/blog/?p=2825" target="_blank">Part &#8211; 7 </a></p>
<p><a style="color: #140b5c !important;" title="Salesforce Certification Mock Test" href="http://www.shivasoft.in/quiz/index.php" target="_blank"> Salesforce Certification Mock Test </a></p>
</div>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-7/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 7'>Salesforce Interview Questions &#8211; Part 7</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 5'>Salesforce Interview Questions &#8211; Part 5</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 1'>Salesforce Interview Questions &#8211; Part 1</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Complete CSS 3 Tutorial &#8211; Transform Operations</title>
		<link>http://shivasoft.in/blog/webtech/web/complete-css-3-tutorial-transform-operations/</link>
		<comments>http://shivasoft.in/blog/webtech/web/complete-css-3-tutorial-transform-operations/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 16:29:51 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[CSS 3]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2753</guid>
		<description><![CDATA[Complete CSS 3 Tutorial - Transform Operations - rotate, translate, scale, skew and matrix methods with Live Demo and source code
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/complete-css-selector-tutorial-for-the-beginners/' rel='bookmark' title='Complete CSS Selector Tutorial for the beginners'>Complete CSS Selector Tutorial for the beginners</a></li>
<li><a href='http://shivasoft.in/blog/webtech/web/create-pure-css-based-menu-step-by-step-tutorial/' rel='bookmark' title='Create Pure CSS based Menu &#8211; Step by Step Tutorial'>Create Pure CSS based Menu &#8211; Step by Step Tutorial</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;"><strong>Cascading Style Sheet (CSS)</strong> is the language used by all the web languages like ASP.Net, PHP, JSP or Velocity (Basically HTML) to control the display style of the elements without changing the code. With the help of CSS we can control the border width, color, background color, background image, font and so on.</p>
<p style="text-align: justify;">With the help of CSS 3 other than just style now we can even animate, translate and do lots of stuff which were not possible by the CSS 2 and needed the help of other JavaScript library like JQuery UI.</p>
<p style="text-align: justify;">In this tutorial we are going to learn different transform operations supported by the CSS 3.</p>
<p style="text-align: justify;">The Transform operations are supported by IE 9, Mozilla, Google Chrome, Safari and Opera.</p>
<h3><a title="CSS3 Live Demo - Tutorial - Transform Operations" href="http://www.shivasoft.in/blog/wp-content/uploads/demos/CSS3/2D%20Transform.html">Live Demo &#8211; Click Here.</a></h3>
<p><span id="more-2753"></span></p>
<p><strong>1. rotate() method</strong></p>
<p>Using this method, we can rotate any element for the specified degree from 0 to 360 having positive or negative value.</p>
<p>Example:</p>
<pre class="brush: css; title: ; notranslate">
transform: rotate(-10deg);
-ms-transform: rotate(-10deg); /* IE 9 */
-webkit-transform: rotate(-10deg); /* Safari and Chrome */
-o-transform: rotate(-10deg); /* Opera */
-moz-transform: rotate(-10deg); /* Firefox */
</pre>
<p>In above code snippet, we have to supply the degree to which element should be rotated. Instead of -10, we can also supply the 350 which will give the same result.</p>
<div id="attachment_2754" class="wp-caption aligncenter" style="width: 541px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-Rotate.png"><img class="size-full wp-image-2754" title="CSS 3 Tutorial Rotate" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-Rotate.png" alt="CSS 3 Tutorial Rotate" width="531" height="140" /></a><p class="wp-caption-text">CSS 3 Tutorial Rotate</p></div>
<p>In CSS3, we have to explicitly specify the filters for different browsers so that they can understand the property.</p>
<ul>
<li>&#8220;<strong>-ms-</strong>&#8221; stands for Microsoft Internet Explorer</li>
<li>&#8220;<strong>-webkit-</strong>&#8221; stands for Safari and Chrome</li>
<li>&#8220;<strong>-o-</strong>&#8221; stands for Opera</li>
<li>&#8220;<strong>-moz-</strong>&#8221; stands for Mozilla</li>
</ul>
<p><strong>2. translate() method</strong></p>
<p>This function causes to move the element from iths original position to specified x and y parameter. This method requires two parameters in which first means transform from x axis and second means transform from y axis.</p>
<p>Other Methods:<br />
<strong>translateX(n)</strong> &#8211; Defines a 2D translation, moving the element along the X-axis<br />
<strong>translateY(n)</strong> &#8211; Defines a 2D translation, moving the element along the Y-axis</p>
<div id="attachment_2755" class="wp-caption aligncenter" style="width: 682px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-Translate.png"><img class=" wp-image-2755 " title="CSS 3 Tutorial Translate" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-Translate.png" alt="CSS 3 Tutorial Translate" width="672" height="45" /></a><p class="wp-caption-text">CSS 3 Tutorial Translate</p></div>
<p>Example :</p>
<pre class="brush: css; title: ; notranslate">
transform: translate(300px,40px);
-ms-transform: translate(300px,40px); /* IE 9 */
-webkit-transform: translate(300px,40px); /* Safari and Chrome */
-o-transform: translate(300px,40px); /* Opera */
-moz-transform: translate(300px,40px); /* Firefox */
</pre>
<p><strong>3. scale() Method</strong><br />
This method is used to increase or decrease the size of the element. any value less than 1 means decrease and any value greater than 1 means increase in size. This method also requires two parameter, first is for the width (x-axis) and second for the height (y-axis).</p>
<div id="attachment_2756" class="wp-caption aligncenter" style="width: 556px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-Scale.png"><img class="size-full wp-image-2756" title="CSS 3 Tutorial Scale" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-Scale.png" alt="CSS 3 Tutorial Scale" width="546" height="100" /></a><p class="wp-caption-text">CSS 3 Tutorial Scale</p></div>
<pre class="brush: css; title: ; notranslate">
transform: scale(1,2);
-ms-transform: scale(1,2); /* IE 9 */
-webkit-transform: scale(1,2); /* Safari and Chrome */
-o-transform: scale(1,2); /* Opera */
-moz-transform: scale(1,2); /* Firefox */
</pre>
<p><strong>4. skew() method</strong><br />
Using this method, element turned on given angle on the basis of x and y parameters. This method requires two parameters, first is the angle for x-axis and second is angle for y-axis.</p>
<div id="attachment_2757" class="wp-caption aligncenter" style="width: 552px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-Skew.png"><img class="size-full wp-image-2757" title="CSS 3 Tutorial Skew" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-Skew.png" alt="CSS 3 Tutorial Skew" width="542" height="144" /></a><p class="wp-caption-text">CSS 3 Tutorial Skew</p></div>
<p>Other Methods:<br />
<strong>skewX(angle)</strong> &#8211; Defines a 2D skew transformation along the X-axis<br />
<strong>skewY(angle)</strong> &#8211; Defines a 2D skew transformation along the Y-axis</p>
<pre class="brush: css; title: ; notranslate">
transform: skew(20deg,10deg);
-ms-transform: skew(20deg,10deg); /* IE 9 */
-webkit-transform: skew(20deg,10deg); /* Safari and Chrome */
-o-transform: skew(20deg,10deg); /* Opera */
-moz-transform: skew(20deg,10deg); /* Firefox */
</pre>
<p><strong>5. matrix()</strong></p>
<p>This is the combination of all above methods and takes 6 parameters.</p>
<div id="attachment_2758" class="wp-caption aligncenter" style="width: 546px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-matrix.png"><img class="size-full wp-image-2758" title="CSS 3 Tutorial matrix" src="http://shivasoft.in/blog/wp-content/uploads/2012/03/CSS-3-Tutorial-matrix.png" alt="CSS 3 Tutorial matrix" width="536" height="178" /></a><p class="wp-caption-text">CSS 3 Tutorial matrix</p></div>
<p><a title="CSS 3 Matrix" href="http://www.useragentman.com/blog/2011/01/07/css3-matrix-transform-for-the-mathematically-challenged/" rel="nofollow" target="_blank">Read in detail about matrix() method of css3</a></p>
<pre class="brush: css; title: ; notranslate">
transform:matrix(1,0.25,-0.25,1,0,0);
-ms-transform:matrix(1,0.25,-0.25,1,0,0); /* IE 9 */
-moz-transform:matrix(1,0.25,-0.25,1,0,0); /* Firefox */
-webkit-transform:matrix(1,0.25,-0.25,1,0,0); /* Safari and Chrome */
-o-transform:matrix(1,0.25,-0.25,1,0,0); /* Opera */
</pre>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/complete-css-selector-tutorial-for-the-beginners/' rel='bookmark' title='Complete CSS Selector Tutorial for the beginners'>Complete CSS Selector Tutorial for the beginners</a></li>
<li><a href='http://shivasoft.in/blog/webtech/web/create-pure-css-based-menu-step-by-step-tutorial/' rel='bookmark' title='Create Pure CSS based Menu &#8211; Step by Step Tutorial'>Create Pure CSS based Menu &#8211; Step by Step Tutorial</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/webtech/web/complete-css-3-tutorial-transform-operations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Release &#8211; Website dedicated to Salesforce Certification Mock Test</title>
		<link>http://shivasoft.in/blog/salesforce/new-release-website-dedicated-to-salesforce-certification-mock-test/</link>
		<comments>http://shivasoft.in/blog/salesforce/new-release-website-dedicated-to-salesforce-certification-mock-test/#comments</comments>
		<pubDate>Sat, 25 Feb 2012 11:56:24 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Salesforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2725</guid>
		<description><![CDATA[New Release - Website for Salesforce certification preparation - free Mock Tests , Interview Questions for Salesforce
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-%e2%80%93-creating-trigger-and-test-cases-%e2%80%93-6-of-6/' rel='bookmark' title='Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6'>Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 1'>Salesforce Interview Questions &#8211; Part 1</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/getting-record-from-one-salesforce-organization-to-other/' rel='bookmark' title='Getting record from other Salesforce organization OR communication between multiple salesforce organization'>Getting record from other Salesforce organization OR communication between multiple salesforce organization</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Hi Friends,<br />
I am very pleased to inform you all that i have created a new website for the mock test, specially for the Salesforce Certifications.<br />
Please have a look and suggest any idea or modifications needed to enhance the functionality of the website. <span style="text-decoration: underline;"><strong>The questions on the website are not from actual exam</strong></span>, instead it will help to brush up the skills for Salesforce certification and also for interview preparations.</p>
<p style="text-align: center;"><strong><a title="Salesforce certification Mock Test" href="http://shivasoft.in/quiz/index.php">New Website URL &#8211; Salesforce Certification Mock Test</a></strong></p>
<p><strong>Screens Shots:</strong><br />
<span id="more-2725"></span></p>
<div id="attachment_2726" class="wp-caption aligncenter" style="width: 680px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/02/Salesforce-Mock-Test-Front-Page.png"><img class=" wp-image-2726 " title="Salesforce Mock Certification Test - Front Page" src="http://shivasoft.in/blog/wp-content/uploads/2012/02/Salesforce-Mock-Test-Front-Page.png" alt="Salesforce Mock Certification Test - Front Page" width="670" height="331" /></a><p class="wp-caption-text">Salesforce Mock Certification Test - Front Page</p></div>
<div id="attachment_2727" class="wp-caption aligncenter" style="width: 565px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/02/Salesforce-Mock-Test-Questions.png"><img class=" wp-image-2727 " title="Salesforce Certification Mock Test - Questions" src="http://shivasoft.in/blog/wp-content/uploads/2012/02/Salesforce-Mock-Test-Questions.png" alt="Salesforce Certification Mock Test - Questions" width="555" height="196" /></a><p class="wp-caption-text">Salesforce Certification Mock Test - Questions</p></div>
<p>In the near future, i am going to add the mock tests for Java as well as .Net also to help the preparation of Salesforce.</p>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/step-by-step-salesforce-tutorial-%e2%80%93-creating-trigger-and-test-cases-%e2%80%93-6-of-6/' rel='bookmark' title='Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6'>Step by Step Salesforce Tutorial – Creating Trigger and Test cases – 6 of 6</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 1'>Salesforce Interview Questions &#8211; Part 1</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/getting-record-from-one-salesforce-organization-to-other/' rel='bookmark' title='Getting record from other Salesforce organization OR communication between multiple salesforce organization'>Getting record from other Salesforce organization OR communication between multiple salesforce organization</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/new-release-website-dedicated-to-salesforce-certification-mock-test/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Handling Colon in Element ID in JQuery &#8211; Visualforce problem</title>
		<link>http://shivasoft.in/blog/others/tips/handling-colon-in-element-id-in-jquery-visualforce-problem/</link>
		<comments>http://shivasoft.in/blog/others/tips/handling-colon-in-element-id-in-jquery-visualforce-problem/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 19:25:12 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Tech Tips]]></category>
		<category><![CDATA[Visualforce]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2706</guid>
		<description><![CDATA[Resolving the JQuery error when the Element ID contains colon with Live Demo
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/web/highlight-current-field-using-jquery/' rel='bookmark' title='Highlight Current field using JQuery'>Highlight Current field using JQuery</a></li>
<li><a href='http://shivasoft.in/blog/webtech/creating-json-parser-using-jquery/' rel='bookmark' title='Creating JSON Parser Using JQuery'>Creating JSON Parser Using JQuery</a></li>
<li><a href='http://shivasoft.in/blog/webtech/web/disable-inputs-after-submit-to-avoid-double-submission-using-jquery-and-ajax/' rel='bookmark' title='Disable inputs after submit to avoid double submission using JQuery and Ajax'>Disable inputs after submit to avoid double submission using JQuery and Ajax</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Today i came across very known problem of jQuery and thought of sharing same with everyone. In Salesforce the element id is in the format of &#8220;<strong>j_id0:j_id3:j_id4:c_txt</strong>&#8220;. In previous post we have already discussed about getting <a title="Get Element ID in Visualforce - Salesforce" href="http://shivasoft.in/blog/salesforce/get-dom-elementid-of-the-visualforce-components/" target="_blank">the elementId in Visualforce</a>.<br />
When i tried to find the element in JQuery like <strong>$(&#8216;#j_id0:j_id3:j_id4:c_txt&#8217;)</strong>, i was getting the error on JavaScript console of the browser. After few searches, i got to know that this is known problem and faced by many of the developers.</p>
<h2 style="text-align: left;"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/02/HandlingColoninJQuery.htm">Live Demo</a></h2>
<p style="text-align: justify;"><span id="more-2706"></span>So here i came with few workarounds as follow:</p>
<p><strong>1. Using Traditional JavaScript:</strong><br />
This was the first option in mind and worked very well. We have to use it very straightforward as always,</p>
<pre class="brush: jscript; title: ; notranslate">
var ele = document.getElementById(&quot;abc:xyz&quot;);
</pre>
<p><strong>2. Using JQuery Approach 1:</strong><br />
In this approach instead of searching by $(&#8220;#abc:xyz&#8221;), we have to search like</p>
<pre class="brush: jscript; title: ; notranslate">
var ele = $('[id=&quot;abc:xyz&quot;]');
</pre>
<p><strong>3. Using JQuery Approach 2:</strong><br />
Use double slash &#8220;\\&#8221; in front of colon which will work as escape sequence</p>
<pre class="brush: jscript; title: ; notranslate">
var ele = $(&quot;#abc\\:xyz&quot;);
</pre>
<p><strong>4. Using JQuery and JavaScript both:</strong><br />
We will find the element by traditional JavaScript and then assign it to the JQuery like</p>
<pre class="brush: jscript; title: ; notranslate">
var ele = document.getElementById('abc:xyz');
ele = $(ele).val();
</pre>
<p><span style="text-decoration: underline;">Complete Source Code demonstrating the scenario:</span></p>
<pre class="brush: xml; title: ; notranslate">
&lt;html&gt;
&lt;head&gt;
&lt;title&gt;
Handling Colon in Element ID in JQuery | ShivaSoft
&lt;/title&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.js&quot;&gt;&lt;/script&gt;
&lt;style&gt;
.myButton {
	-moz-box-shadow:inset 0px 1px 0px 0px #ffffff;
	-webkit-box-shadow:inset 0px 1px 0px 0px #ffffff;
	box-shadow:inset 0px 1px 0px 0px #ffffff;
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #ededed), color-stop(1, #dfdfdf) );
	background:-moz-linear-gradient( center top, #ededed 5%, #dfdfdf 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ededed', endColorstr='#dfdfdf');
	background-color:#ededed;
	-moz-border-radius:6px;
	-webkit-border-radius:6px;
	border-radius:6px;
	border:1px solid #dcdcdc;
	display:inline-block;
	color:#777777;
	font-family:arial;
	font-size:15px;
	font-weight:bold;
	padding:6px 24px;
	text-decoration:none;
	text-shadow:1px 1px 0px #ffffff;
	cursor:pointer;
}.myButton:hover {
	background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #dfdfdf), color-stop(1, #ededed) );
	background:-moz-linear-gradient( center top, #dfdfdf 5%, #ededed 100% );
	filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#dfdfdf', endColorstr='#ededed');
	background-color:#dfdfdf;
}.myButton:active {
	position:relative;
	top:1px;
}
code
{
	color:green;
}
.error
{
	color:red;
}
&lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;input value=&quot;ShivaSoft&quot; type=&quot;text&quot; size=&quot;30&quot; id=&quot;abc:xyz&quot; /&gt; &lt;br /&gt;
&lt;input class=&quot;myButton&quot; type=&quot;button&quot; value=&quot;Clear Ans&quot; onclick=&quot;clearAns()&quot; /&gt;
&lt;br /&gt;

&lt;input class=&quot;myButton&quot; type=&quot;button&quot; value=&quot;Simple jQuery&quot; onclick=&quot;simpleJQuery()&quot; /&gt;
Using &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code class=&quot;error&quot;&gt;$(&quot;#abc:xyz&quot;)&lt;/code&gt;
&lt;br /&gt;

&lt;input class=&quot;myButton&quot; type=&quot;button&quot; value=&quot;Traditional JS&quot; onclick=&quot;simpleJS()&quot; /&gt;
Using &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt; document.getElementById(&quot;abc:xyz&quot;)&lt;/code&gt;
&lt;br /&gt;

&lt;input class=&quot;myButton&quot; type=&quot;button&quot; value=&quot;JQuery-Approach1&quot; onclick=&quot;app1()&quot; /&gt;
Using &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt;$('[id=&quot;abc:xyz&quot;]')&lt;/code&gt;
&lt;br /&gt;

&lt;input class=&quot;myButton&quot; type=&quot;button&quot; value=&quot;JQuery-Approach2&quot; onclick=&quot;app2()&quot; /&gt;
Using double slash (Escape sequence) in front of colon &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;code&gt;$(&quot;#abc\\:xyz&quot;)&lt;/code&gt;
&lt;br /&gt;

&lt;input class=&quot;myButton&quot; type=&quot;button&quot; value=&quot;JQuery-Approach3&quot; onclick=&quot;app3()&quot; /&gt;
This is workaround. Get element by Javascript and pass to jQuery  &amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;code&gt;
&lt;pre&gt;
	var ans = document.getElementById('abc:xyz');
	ans = $(ans).val();
&lt;/pre&gt;
&lt;/code&gt;
&lt;br /&gt;

&lt;hr /&gt;
Output -
&lt;div id=&quot;divOut&quot; style=&quot;background-color:yellow&quot; /&gt;

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

function app3()
{
	clearAns();
	var ans = document.getElementById('abc:xyz');
	ans = $(ans).val();
	printAns(ans);
}

function app2()
{
	clearAns();
	var ans = $(&quot;#abc\\:xyz&quot;).val();
	printAns(ans);
}

function app1()
{
	clearAns();
	var ans = $('[id=&quot;abc:xyz&quot;]').val();
	printAns(ans);
}

function simpleJQuery()
{
	clearAns();
	var ans = $(&quot;#abc:xyz&quot;).val();
	printAns(ans);
}

function simpleJS()
{
	clearAns();
	var ans = document.getElementById(&quot;abc:xyz&quot;).value;
	printAns(ans);
}

function clearAns()
{
	$(&quot;#divOut&quot;).html('');
}
function printAns(ans)
{
	var ansDiv = $(&quot;#divOut&quot;);
	ansDiv.html(ans);
	ansDiv.css(&quot;background-color&quot;,randColor());
}
function randColor()
{
    colors = ['orange', '#ccc', 'blue', 'green','yellow','lightGreen']
    return colors[Math.floor(Math.random()*colors.length)];
}
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
<h2><a href="http://shivasoft.in/blog/wp-content/uploads/2012/02/HandlingColoninJQuery.htm">Live Demo</a></h2>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/web/highlight-current-field-using-jquery/' rel='bookmark' title='Highlight Current field using JQuery'>Highlight Current field using JQuery</a></li>
<li><a href='http://shivasoft.in/blog/webtech/creating-json-parser-using-jquery/' rel='bookmark' title='Creating JSON Parser Using JQuery'>Creating JSON Parser Using JQuery</a></li>
<li><a href='http://shivasoft.in/blog/webtech/web/disable-inputs-after-submit-to-avoid-double-submission-using-jquery-and-ajax/' rel='bookmark' title='Disable inputs after submit to avoid double submission using JQuery and Ajax'>Disable inputs after submit to avoid double submission using JQuery and Ajax</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/others/tips/handling-colon-in-element-id-in-jquery-visualforce-problem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to create Immutable Class in Java</title>
		<link>http://shivasoft.in/blog/java/how-to-create-immutable-class-in-java/</link>
		<comments>http://shivasoft.in/blog/java/how-to-create-immutable-class-in-java/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 12:34:46 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[final]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2700</guid>
		<description><![CDATA[creating the Immutable class in Java with simple source code example
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/java/immutable-nature-of-string-java/' rel='bookmark' title='Immutable nature of String &#8211; JAVA'>Immutable nature of String &#8211; JAVA</a></li>
<li><a href='http://shivasoft.in/blog/java/create-soap-message-using-java/' rel='bookmark' title='Create SOAP message using Java'>Create SOAP message using Java</a></li>
<li><a href='http://shivasoft.in/blog/java/snmp/create-snmp-client-in-java-using-snmp4j/' rel='bookmark' title='Create SNMP Client in JAVA Using SNMP4j'>Create SNMP Client in JAVA Using SNMP4j</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">We have heard the word &#8220;<strong>Immutable class</strong>&#8221; lots of time in Java. The best example is class &#8220;<strong><a title="Immutable nature of string" href="http://shivasoft.in/blog/java/immutable-nature-of-string-java/" target="_blank">String</a></strong>&#8220;. Immutable class is the class whose value cannot be changed throughout the life cycle. We cannot change the content of String class, everytime new reference is created when we change the content, that is the basic difference between <strong>String</strong> and <strong>StringBuffer</strong> Class.<br />
In this article, i will explain the step by step process to create the custom Immutable class in Java.<br />
Our class should not able to derived and for that we will declare our class as final. The values cannot be change and thats why we will declare all the variables as final and we will provide only the getter methods as we cannot write setters because of final variables.<br />
So to summarize, following steps needs to be taken:<span id="more-2700"></span></p>
<ol>
<li><strong>declare class as final</strong></li>
<li><strong>declare all variables as final</strong></li>
<li><strong>provide constructor to set the values</strong></li>
<li><strong>provide getter</strong></li>
</ol>
<p>Source code:</p>
<pre class="brush: java; title: ; notranslate">
package in.shivasoft.demo;

final class Immutable
{
	private final int val1;
	private final String val2;

	public Immutable(int a, String s)
	{
		val1 = a;
		val2 = s;
	}
	public int getVal1()
	{
		return val1;
	}
	public String getVal2()
	{
		return val2;
	}
}

public class ImmutableClassDemo {
	public static void main(String[] args) {
		Immutable obj = new Immutable(10, &quot;ShivaSoft ...the supreme solution&quot;);
		System.out.println(obj.getVal1());
		System.out.println(obj.getVal2());
	}
}
</pre>
<p>Output :</p>
<blockquote><p>10<br />
ShivaSoft &#8230;the supreme solution</p></blockquote>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/java/immutable-nature-of-string-java/' rel='bookmark' title='Immutable nature of String &#8211; JAVA'>Immutable nature of String &#8211; JAVA</a></li>
<li><a href='http://shivasoft.in/blog/java/create-soap-message-using-java/' rel='bookmark' title='Create SOAP message using Java'>Create SOAP message using Java</a></li>
<li><a href='http://shivasoft.in/blog/java/snmp/create-snmp-client-in-java-using-snmp4j/' rel='bookmark' title='Create SNMP Client in JAVA Using SNMP4j'>Create SNMP Client in JAVA Using SNMP4j</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/java/how-to-create-immutable-class-in-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Create SOAP message using Java</title>
		<link>http://shivasoft.in/blog/java/create-soap-message-using-java/</link>
		<comments>http://shivasoft.in/blog/java/create-soap-message-using-java/#comments</comments>
		<pubDate>Thu, 02 Feb 2012 17:46:37 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[JAVA]]></category>
		<category><![CDATA[Web Service]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2691</guid>
		<description><![CDATA[Step by Step Example of creating SOAP Message using core Java API
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/java/snmp/create-snmp-client-in-java-using-snmp4j/' rel='bookmark' title='Create SNMP Client in JAVA Using SNMP4j'>Create SNMP Client in JAVA Using SNMP4j</a></li>
<li><a href='http://shivasoft.in/blog/java/how-to-create-immutable-class-in-java/' rel='bookmark' title='How to create Immutable Class in Java'>How to create Immutable Class in Java</a></li>
<li><a href='http://shivasoft.in/blog/java/create-xml-file-using-jaxp-and-transformation-apis/' rel='bookmark' title='Create XML File using DOM Parser of JAXP and Transformation APIs'>Create XML File using DOM Parser of JAXP and Transformation APIs</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In this article, i am going to create the <a title="What is SOAP in Webservice" href="http://en.wikipedia.org/wiki/SOAP" target="_blank">SOAP </a>Message by using core Java Only. SOAP Stands for &#8221; Simple Object Access Protocol&#8221;, which is used to exchange the structured information via <a title="What is Web Services" href="http://en.wikipedia.org/wiki/Web_Service" target="_blank">Webservices</a>.</p>
<p>SOAP Message consist of following three parts:</p>
<ol>
<li>SOAP-ENV:Envelope</li>
<li>SOAP-ENV:Header</li>
<li>SOAP-ENV:Body</li>
</ol>
<div id="attachment_2694" class="wp-caption aligncenter" style="width: 230px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/02/SOAP.png"><img class="size-full wp-image-2694" title="SOAP Message Format for Web Services" src="http://shivasoft.in/blog/wp-content/uploads/2012/02/SOAP.png" alt="SOAP Message Format for Web Services" width="220" height="235" /></a><p class="wp-caption-text">SOAP Message Format for Web Services</p></div>
<p><span id="more-2691"></span>To create the SOAP, first we will need to create the object of &#8220;<strong>javax.xml.soap.MessageFactory</strong>&#8220;, then create object of &#8220;<strong>javax.xml.soap.SOAPMessage</strong>&#8220;. This object of &#8220;SOAPMessage&#8221; will have all the messages inside it in &#8220;<strong>javax.xml.soap.SOAPEnvelope</strong>&#8221; object. Every &#8220;Envelope&#8221; will have the &#8220;Header&#8221; and &#8220;Body&#8221; as shown in below program:</p>
<pre class="brush: csharp; title: ; notranslate">
package com.service.SOAPMain;

import java.io.FileOutputStream;

import javax.xml.soap.MessageFactory;
import javax.xml.soap.SOAPBody;
import javax.xml.soap.SOAPBodyElement;
import javax.xml.soap.SOAPEnvelope;
import javax.xml.soap.SOAPHeader;
import javax.xml.soap.SOAPMessage;
import javax.xml.soap.SOAPPart;

public class CreateSOAPMessage {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try{
			MessageFactory factory = MessageFactory.newInstance();
			SOAPMessage soapMsg = factory.createMessage();
			SOAPPart part = soapMsg.getSOAPPart();

			SOAPEnvelope envelope = part.getEnvelope();
			SOAPHeader header = envelope.getHeader();
			SOAPBody body = envelope.getBody();

			header.addTextNode(&quot;Training Details&quot;);

			SOAPBodyElement element = body.addBodyElement(envelope.createName(&quot;JAVA&quot;, &quot;training&quot;, &quot;http://shivasoft.in/blog&quot;));
			element.addChildElement(&quot;WS&quot;).addTextNode(&quot;Training on Web service&quot;);

			SOAPBodyElement element1 = body.addBodyElement(envelope.createName(&quot;JAVA&quot;, &quot;training&quot;, &quot;http://shivasoft.in/blog&quot;));
			element1.addChildElement(&quot;Spring&quot;).addTextNode(&quot;Training on Spring 3.0&quot;);

			soapMsg.writeTo(System.out);

			FileOutputStream fOut = new FileOutputStream(&quot;SoapMessage.xml&quot;);
			soapMsg.writeTo(fOut);

			System.out.println();
			System.out.println(&quot;SOAP msg created&quot;);

		}catch(Exception e){
			e.printStackTrace();
		}

	}

}
</pre>
<p>As the output, one xml file of named &#8220;SoapMessage.xml&#8221; will be created and also printed on the console.</p>
<div id="attachment_2695" class="wp-caption aligncenter" style="width: 586px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/02/SOAP-Messsage-Output-Java.png"><img class="size-full wp-image-2695" title="SOAP Messsage Output - Java" src="http://shivasoft.in/blog/wp-content/uploads/2012/02/SOAP-Messsage-Output-Java.png" alt="SOAP Messsage Output - Java" width="576" height="173" /></a><p class="wp-caption-text">SOAP Messsage Output - Java</p></div>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/java/snmp/create-snmp-client-in-java-using-snmp4j/' rel='bookmark' title='Create SNMP Client in JAVA Using SNMP4j'>Create SNMP Client in JAVA Using SNMP4j</a></li>
<li><a href='http://shivasoft.in/blog/java/how-to-create-immutable-class-in-java/' rel='bookmark' title='How to create Immutable Class in Java'>How to create Immutable Class in Java</a></li>
<li><a href='http://shivasoft.in/blog/java/create-xml-file-using-jaxp-and-transformation-apis/' rel='bookmark' title='Create XML File using DOM Parser of JAXP and Transformation APIs'>Create XML File using DOM Parser of JAXP and Transformation APIs</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/java/create-soap-message-using-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Salesforce Interview Questions &#8211; Part 5</title>
		<link>http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/</link>
		<comments>http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 19:35:58 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Force.com]]></category>
		<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Visualforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2681</guid>
		<description><![CDATA[Basic concepts and Interview Questions of salesforce, Visualforce, Apex and SOQL
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-7/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 7'>Salesforce Interview Questions &#8211; Part 7</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-%e2%80%93-part-3/' rel='bookmark' title='Salesforce Interview Questions – Part 3'>Salesforce Interview Questions – Part 3</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 6'>Salesforce Interview Questions &#8211; Part 6</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; padding-bottom: 10px; margin-top: 10px; color: #140b5c;">
<p><a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 1" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions/" target="_blank"> Part &#8211; 1</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 2" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions-%E2%80%93-part-2/" target="_blank">Part &#8211; 2</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 3" href="http://shivasoft.in/blog/tips/salesforce-interview-questions-%E2%80%93-part-3/" target="_blank"> Part &#8211; 3</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 4 - Dynamic Apex" href="http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/" target="_blank">Part &#8211; 4 &#8211; Dynamic Apex</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 5" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/" target="_blank">Part &#8211; 5 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 6" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/" target="_blank">Part &#8211; 6 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 7" href="http://shivasoft.in/blog/?p=2825" target="_blank">Part &#8211; 7 </a></p>
<p><a style="color: #140b5c !important;" title="Salesforce Certification Mock Test" href="http://www.shivasoft.in/quiz/index.php" target="_blank"> Salesforce Certification Mock Test </a></p>
</div>
<p><strong>40. What is Master Detail relationship and look up relationship in Salesforce?</strong><br />
<strong> Ans:</strong><br />
Master Detail relationship is the<strong> Parent child relationship</strong>. In which Master represents Parent and detail represents Child. If Parent is deleted then Child also gets deleted. Rollup summary fields can only be created on Master records which will calculate the SUM, AVG, MIN of the Child records.<br />
Look up relationship is something like <strong>&#8220;has-a&#8221; (Containership) relationship</strong>. Where one record has reference to other records. When one record is deleted then there is no impact on other records.</p>
<hr />
<p><strong>41. Can we convert the lookup relationship to Master Detail relationship?</strong><br />
<strong> Ans:</strong><br />
We can convert the lookup relationship to master detail relationship if and only if all the existing record has valid lookup field.</p>
<hr />
<p><strong>42. In How many way we can invoke the Apex class?</strong><br />
<strong> Ans:</strong></p>
<ol>
<li>Visualforce page</li>
<li>Trigger</li>
<li>Web Services</li>
<li><a title="Email Services" href="http://shivasoft.in/blog/salesforce/email-services-in-salesforce-with-simple-example/" target="_blank">Email Services</a></li>
</ol>
<hr />
<p><strong><span id="more-2681"></span>43. Can we create Master Detail relationship on existing records?</strong><br />
<strong> Ans:</strong><br />
No. As discussed above, first we have to create the lookup relationship then populate the value on all existing record and then convert it.</p>
<hr />
<p><strong>44. How validation rules executed? is it page layout / Visualforce dependent?</strong><br />
<strong> Ans :</strong><br />
The validation rules run at the data model level, so they are not affected by the UI. Any record that is saved in Salesforce will run through the validation rules.</p>
<hr />
<p><strong>45. What is the difference between database.insert and insert ?</strong><br />
<strong> Ans:</strong><br />
<strong>insert</strong> is the DML statement which is same as <strong>databse.insert</strong>. However, database.insert gives more flexibility like rollback, default assignment rules etc. we can achieve the database.insert behavior in insert by using the method setOptions(Database.DMLOptions)<br />
<strong>Important Difference:</strong></p>
<ul>
<li>If we use the DML statement (insert), then in bulk operation if error occurs, the execution will stop and Apex code throws an error which can be handled in try catch block.</li>
<li>If DML database methods (Database.insert) used, then if error occurs the remaining records will be inserted / updated means partial DML operation will be done.</li>
</ul>
<hr />
<p><strong>46. What is the scope of static variable ?</strong><br />
<strong> Ans:</strong><br />
When you declare a method or variable as static, it&#8217;s initialized only once when a class is loaded. Static variables aren&#8217;t transmitted as part of the view state for a Visualforce page.</p>
<p>Static variables are only static within the scope of the request. They are not static across the server, or across the entire organization.</p>
<hr />
<p><strong>47. Other than SOQL and SOSL what is other way to get custom settings?</strong><br />
<strong> Ans:</strong><br />
Other than SOQL or SOSL, Custom seting have there own set of methods to access the record.<br />
For example : if there is custom setting of name ISO_Country,</p>
<pre class="brush: csharp; title: ; notranslate">
SO_Country__c code = ISO_Country__c.getInstance(‘INDIA’);
//To return a map of data sets defined for the custom object (all records in the custom object), //you would use:
Map&lt;String,ISO_Country__c&gt; mapCodes = ISO_Country__c.getAll();
// display the ISO code for India
System.debug(‘ISO Code: ‘+mapCodes.get(‘INDIA’).ISO_Code__c);
//Alternatively you can return the map as a list:
List&lt;String&gt; listCodes = ISO_Country__c.getAll().values();
</pre>
<hr />
<p><strong>48. What happen if child have two master records and one is deleted?</strong><br />
<strong> Ans :</strong><br />
Child record will be deleted.</p>
<p><a title="More than one master record" href="http://shivasoft.in/blog/webtech/salesforce/deep-drive-in-junction-object-create-many-to-many-relationship-in-salesforce/" target="_blank">read more in this article.</a></p>
<hr />
<p><strong>49. What is Difference in render, rerender and renderas attributes of visualforce?</strong><br />
<strong> Ans:</strong><br />
<strong>render</strong> &#8211; It works like &#8220;display&#8221; property of CSS. Used to show or hide element.<br />
<strong>rerender</strong> &#8211; After Ajax which component should be refreshed &#8211; available on commandlink, commandbutton, actionsupport etc.<br />
<strong>renderas</strong> &#8211; render page as pdf, doc and excel.</p>
<hr />
<p><strong>50. What is Scheduler class in Apex?</strong><br />
<strong> Ans:</strong><br />
The Apex class which is programed to run at pre defined interval.<br />
Class must implement <strong>schedulable</strong> interface and it contains method named execute().<br />
There are two ways to invoke schedular :</p>
<ol>
<li>Using UI</li>
<li>Using System.schedule</li>
</ol>
<p>The class which implements interface schedulable get the button texted with “Schedule”, when user clicks on that button, new interface opens to schedule the classes which implements that interface.<br />
To see what happened to scheduled job, go to “<strong>Monitoring | Scheduled jobs</strong> “</p>
<p>Example of scheduling :</p>
<pre class="brush: csharp; title: ; notranslate">
scheduledMerge m = new scheduledMerge();
String sch = '20 30 8 10 2 ?';
system.schedule('Merge Job', sch, m);
</pre>
<p>To see how to make crone job string &#8211; <a title="Crone Job String Maker" href="http://www.cronmaker.com/" target="_blank">refer this URL</a>.</p>
<hr />
<div style="background-color: #f5e2ba; border: 1px solid #ccc; width: 100%; padding-top: 10px; padding-bottom: 10px; margin-top: 10px; color: #140b5c;">
<p><a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 1" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions/" target="_blank"> Part &#8211; 1</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 2" href="http://shivasoft.in/blog/webtech/salesforce/salesforce-interview-questions-%E2%80%93-part-2/" target="_blank">Part &#8211; 2</a> | <a style="color: #140b5c !important;" title="Salesforce Interview Questions Part 3" href="http://shivasoft.in/blog/tips/salesforce-interview-questions-%E2%80%93-part-3/" target="_blank"> Part &#8211; 3</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 4 - Dynamic Apex" href="http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/" target="_blank">Part &#8211; 4 &#8211; Dynamic Apex</a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 5" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/" target="_blank">Part &#8211; 5 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 6" href="http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/" target="_blank">Part &#8211; 6 </a> | <a style="color: #140b5c !important;" title="Latest Salesforce Interview Questions Part 7" href="http://shivasoft.in/blog/?p=2825" target="_blank">Part &#8211; 7 </a></p>
<p><a style="color: #140b5c !important;" title="Salesforce Certification Mock Test" href="http://www.shivasoft.in/quiz/index.php" target="_blank"> Salesforce Certification Mock Test </a></p>
</div>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-7/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 7'>Salesforce Interview Questions &#8211; Part 7</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-%e2%80%93-part-3/' rel='bookmark' title='Salesforce Interview Questions – Part 3'>Salesforce Interview Questions – Part 3</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-6/' rel='bookmark' title='Salesforce Interview Questions &#8211; Part 6'>Salesforce Interview Questions &#8211; Part 6</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/salesforce-interview-questions-part-5/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Create Simple Drag and Drop Widget like iGoogle using JQuery</title>
		<link>http://shivasoft.in/blog/webtech/web/create-simple-drag-and-drop-widget-like-igoogle-using-jquery/</link>
		<comments>http://shivasoft.in/blog/webtech/web/create-simple-drag-and-drop-widget-like-igoogle-using-jquery/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 19:10:27 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[JQuery]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2657</guid>
		<description><![CDATA[Live Demo with source code on creating Simple Drag and Drop Widget using JQuery plugin like iGoogle 
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/web/highlight-current-field-using-jquery/' rel='bookmark' title='Highlight Current field using JQuery'>Highlight Current field using JQuery</a></li>
<li><a href='http://shivasoft.in/blog/java/servlet/servlet-hibernate-jquery-and-ajax-based-google-like-chat/' rel='bookmark' title='Servlet, Hibernate, jQuery and Ajax based google like chat'>Servlet, Hibernate, jQuery and Ajax based google like chat</a></li>
<li><a href='http://shivasoft.in/blog/webtech/web/disable-inputs-after-submit-to-avoid-double-submission-using-jquery-and-ajax/' rel='bookmark' title='Disable inputs after submit to avoid double submission using JQuery and Ajax'>Disable inputs after submit to avoid double submission using JQuery and Ajax</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>After reading this post you will come to know that how easy its to create the Drag and Drop functionality using JQuery.</p>
<p>To run this example you will need two javascript libraries as follow:</p>
<ol>
<li><a href="http://jquery.com/">JQuery</a></li>
<li><a href="http://jqueryui.com/">JQueryUI</a></li>
</ol>
<div id="attachment_2661" class="wp-caption aligncenter" style="width: 601px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/01/jQuery-Drag-and-Drop-Widgets.png"><img class=" wp-image-2661  " title="jQuery Drag and Drop Widgets" src="http://shivasoft.in/blog/wp-content/uploads/2012/01/jQuery-Drag-and-Drop-Widgets.png" alt="jQuery Drag and Drop Widgets" width="591" height="234" /></a><p class="wp-caption-text">jQuery Drag and Drop Widgets</p></div>
<p><span id="more-2657"></span></p>
<h3><a href="http://shivasoft.in/blog/wp-content/uploads/demos/DragAndDrop/index.html">You can see the complete working demo here</a></h3>
<p>Lets say you want to create the widget in two columns, so first create two DIV tags as shown below:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;column1&quot; class=&quot;column&quot;&gt;
&lt;!-- Widgets code here --&gt;
&lt;/div&gt;

&lt;div id=&quot;column2&quot;  class=&quot;column&quot;&gt;
&lt;!-- Widgets code here --&gt;
&lt;/div&gt;
</pre>
<p>We are assuming that we can drag the elements from column1 to column2 and vice verse.</p>
<p>Now we will create the actual element which can be drag-gable.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;div id=&quot;column1&quot; class=&quot;column&quot;&gt;
	&lt;div class=&quot;dragbox&quot; id=&quot;item1&quot; &gt;
		&lt;h2&gt;Handle 1
		  &lt;a href=&quot;#&quot; class=&quot;delete opIcons&quot;&gt; &lt;/a&gt;
		  &lt;a href=&quot;#&quot; class=&quot;maxmin opIcons&quot;&gt; &lt;/a&gt;

		&lt;/h2&gt;
		&lt;div class=&quot;dragbox-content&quot; &gt;
			&lt;!-- Panel Content Here --&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;

&lt;div id=&quot;column2&quot;  class=&quot;column&quot;&gt;
	&lt;div class=&quot;dragbox&quot; id=&quot;item2&quot; &gt;
		&lt;h2&gt;Handle 2
		  &lt;a href=&quot;#&quot; class=&quot;delete opIcons&quot;&gt; &lt;/a&gt;
		  &lt;a href=&quot;#&quot; class=&quot;maxmin opIcons&quot;&gt; &lt;/a&gt;

		&lt;/h2&gt;
		&lt;div class=&quot;dragbox-content&quot; &gt;
			&lt;!-- Panel Content Here --&gt;
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/div&gt;
</pre>
<p>As you can see &lt;h2&gt; tag is used to create the heading and there are two &lt;a&gt; (anchor) tags, one for delete and one for toggle.</p>
<p>Now its time to write the JQuery code to drag and drop the &lt;div&gt; tag with <strong>class=&#8221;dragbox&#8221;</strong></p>
<pre class="brush: jscript; title: ; notranslate">
$(
function(){
	$('a.maxmin').click(
	function(){
		$(this).parent().siblings('.dragbox-content').toggle();
	});

	$('a.delete').click(
	function(){
		var sel = confirm('do you want to delete the widget?');
		if(sel)
		{
			//del code here
		}
	}
	);

	$('.column').sortable({
	connectWith: '.column',
	handle: 'h2',
	cursor: 'move',
	placeholder: 'placeholder',
	forcePlaceholderSize: true,
	opacity: 0.4,
	stop: function(event, ui)
		{
			$(ui.item).find('h2').click();
			var sortorder='';

			$('.column').each(function(){
				var itemorder=$(this).sortable('toArray');
				var columnId=$(this).attr('id');
				sortorder+=columnId+'='+itemorder.toString()+'&amp;';
			});
			sortorder = sortorder.substring(0, sortorder.length - 1)
			alert('SortOrder: '+sortorder);

		}
	}).disableSelection();
});
</pre>
<p style="text-align: justify;">As you can see, on dom ready event using $() &#8211; which is equal to &#8220;$.ready()&#8221;, we have written the code like $(&#8216;.column&#8217;).sortable(&#8230;) which will perform the drag and drop functionality. the &#8220;sortable&#8221; functionality is used to save the state of the widget in database so that next time you can load the widget in order which they are previously for this you will need to do some extra code here. The sort result is displayed using alert after element drop.</p>
<p style="text-align: justify;">For the delete action, i have written the comment where server request can be called using Ajax to delete the widget. With the help of below CSS this example will be completed with nice look and feel.</p>
<pre class="brush: css; title: ; notranslate">
.column{
	width:49%;
	margin-right:.5%;
	min-height:300px;
	background:#fff;
	float:left;
}
.column .dragbox{
	margin:5px 2px  20px;
	background:#fff;
	position:&quot;relative&quot;;
	border:1px solid #946553;
	-moz-border-radius:5px;
	-webkit-border-radius:5px;
}
.column .dragbox h2{
	margin:0;
	font-size:12px;
	background:#946553;
	color:#fff;
	border-bottom:1px solid #946553;
	font-family:Verdana;
	cursor:move;
	padding:5px;
}

.dragbox-content{
	background:#fff;
	min-height:100px; margin:5px;
	font-family:'Lucida Grande', Verdana; font-size:0.8em; line-height:1.5em;
}
.column  .placeholder{
	background: #EED5B7;
	border:1px dashed #946553;
}

.opIcons
{
background-image: url('iconSpirite.gif')!important;
background-repeat: no-repeat;
float:right;
height:13px;
width:13px;
margin:0px 2px;
}

.maxmin
{
	background-position:-26px 1px;
}

.delete
{
	background-position:-269px center;
	padding-top:1px;
}
</pre>
<h3><a href="http://shivasoft.in/blog/wp-content/uploads/demos/DragAndDrop/index.html">You can see the complete working demo here</a></h3>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/webtech/web/highlight-current-field-using-jquery/' rel='bookmark' title='Highlight Current field using JQuery'>Highlight Current field using JQuery</a></li>
<li><a href='http://shivasoft.in/blog/java/servlet/servlet-hibernate-jquery-and-ajax-based-google-like-chat/' rel='bookmark' title='Servlet, Hibernate, jQuery and Ajax based google like chat'>Servlet, Hibernate, jQuery and Ajax based google like chat</a></li>
<li><a href='http://shivasoft.in/blog/webtech/web/disable-inputs-after-submit-to-avoid-double-submission-using-jquery-and-ajax/' rel='bookmark' title='Disable inputs after submit to avoid double submission using JQuery and Ajax'>Disable inputs after submit to avoid double submission using JQuery and Ajax</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/webtech/web/create-simple-drag-and-drop-widget-like-igoogle-using-jquery/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Get DOM ElementID of the Visualforce components</title>
		<link>http://shivasoft.in/blog/salesforce/get-dom-elementid-of-the-visualforce-components/</link>
		<comments>http://shivasoft.in/blog/salesforce/get-dom-elementid-of-the-visualforce-components/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 08:23:53 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Visualforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2649</guid>
		<description><![CDATA[How to get the  DOM ElementID of the Visualforce components in Salesforce
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/passing-parameter-in-actionfunction-in-visualforce/' rel='bookmark' title='Passing multiple Parameters in ActionFunction in Visualforce'>Passing multiple Parameters in ActionFunction in Visualforce</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/how-to-host-s-control-in-visualforce-page/' rel='bookmark' title='How to Host S-Control in Visualforce Page'>How to Host S-Control in Visualforce Page</a></li>
<li><a href='http://shivasoft.in/blog/webtech/salesforce-tutorial-create-simple-ajax-based-visualforce-page/' rel='bookmark' title='Salesforce Tutorial &#8211; Create Simple Ajax based Visualforce page'>Salesforce Tutorial &#8211; Create Simple Ajax based Visualforce page</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>This article will focus on getting generated dom element Id in Visualforce.<br />
Let’s consider below code snap:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:page&gt;
&lt;apex:form id=&quot;frm&quot;&gt;
Enter Value 1 :
&lt;apex:inputText id=&quot;txt1&quot; /&gt;
&lt;/apex:form&gt;
&lt;/apex:page&gt;
</pre>
<p>If you want to get the id of <strong>“apex:inputText”</strong> in javascript like belowCode</p>
<pre class="brush: jscript; title: ; notranslate">
Var fld =  document.getElementById(‘txt1’);
</pre>
<p>It will <strong>NOT</strong> work.<br />
Because its actual id will be something like “<em>j_id0:frm:txt1</em>”.</p>
<p><span id="more-2649"></span>To get the Actual id in Visualforce page we have to use below line of code:</p>
<pre class="brush: jscript; title: ; notranslate">
Var fld =  document.getElementById(&quot;{!$Component.txt1}&quot;);
</pre>
<p>As you can see, we have to use below Syntax:</p>
<blockquote><p>{!$Component.fieldId}</p></blockquote>
<p><strong>Case 1:</strong><br />
However there is one catch. If the element is present at several levels where Parents also have the Id then you have to write code like:</p>
<pre class="brush: jscript; title: ; notranslate">
{!$Component.Parent1.Parent2.fieldId}
</pre>
<p><strong>Case 2:</strong><br />
If your element is within form tag having no Id like :</p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:page&gt;
&lt;apex:form&gt;
Enter Value 1 :
&lt;apex:inputText id=&quot;txt1&quot; /&gt;
&lt;/apex:form&gt;
&lt;/apex:page&gt;
</pre>
<p>And you try to get the id like</p>
<pre class="brush: jscript; title: ; notranslate">
Var fld =  document.getElementById(&quot;{!$Component.txt1}&quot;);
</pre>
<p>It will <strong>NOT</strong> work.<br />
You must have to give the Id to “<strong>apex:form</strong>” element and access it.</p>
<p>Example Working code:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:page&gt;
&lt;apex:form id=&quot;frm&quot;&gt;
Enter Value 1 :
&lt;apex:inputText id=&quot;txt1&quot; /&gt;
&lt;/apex:form&gt;
&lt;/apex:page&gt;
</pre>
<p>Get Id by using code:</p>
<pre class="brush: jscript; title: ; notranslate">
Var fld =  document.getElementById(&quot;{!$Component.frm.txt1}&quot;);
</pre>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/passing-parameter-in-actionfunction-in-visualforce/' rel='bookmark' title='Passing multiple Parameters in ActionFunction in Visualforce'>Passing multiple Parameters in ActionFunction in Visualforce</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/how-to-host-s-control-in-visualforce-page/' rel='bookmark' title='How to Host S-Control in Visualforce Page'>How to Host S-Control in Visualforce Page</a></li>
<li><a href='http://shivasoft.in/blog/webtech/salesforce-tutorial-create-simple-ajax-based-visualforce-page/' rel='bookmark' title='Salesforce Tutorial &#8211; Create Simple Ajax based Visualforce page'>Salesforce Tutorial &#8211; Create Simple Ajax based Visualforce page</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/get-dom-elementid-of-the-visualforce-components/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Getting record from other Salesforce organization OR communication between multiple salesforce organization</title>
		<link>http://shivasoft.in/blog/salesforce/getting-record-from-one-salesforce-organization-to-other/</link>
		<comments>http://shivasoft.in/blog/salesforce/getting-record-from-one-salesforce-organization-to-other/#comments</comments>
		<pubDate>Tue, 17 Jan 2012 17:55:52 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Apex]]></category>
		<category><![CDATA[Force.com]]></category>
		<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Visualforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2624</guid>
		<description><![CDATA[Calling Rest Web service using Apex - Getting record from other Salesforce organization or Account or communication between multiple salesforce organization
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/passing-parameter-in-actionfunction-in-visualforce/' rel='bookmark' title='Passing multiple Parameters in ActionFunction in Visualforce'>Passing multiple Parameters in ActionFunction in Visualforce</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/' rel='bookmark' title='Dynamic Approval Process in Salesforce based on the Apex and Trigger'>Dynamic Approval Process in Salesforce based on the Apex and Trigger</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/' rel='bookmark' title='Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex'>Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>In this article, i will explain the code which can be used for connecting and getting the records from different or multiple salesforce organization using Apex and REST Service.</p>
<p>To start first we will need to authorize below two URL which can be accessed from salesforce environment.<br />
This can be done from <strong>“Setup | Administration Setup | Security Controls | Remote Site Settings”</strong></p>
<ol>
<li><a href="https://www.salesforce.com">https://www.salesforce.com</a></li>
<li><a href="https://ap1-api.salesforce.com">https://ap1-api.salesforce.com</a></li>
</ol>
<div id="attachment_2625" class="wp-caption aligncenter" style="width: 485px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/01/Salesforce-Remote-Site-Setting.png"><img class=" wp-image-2625   " title="Salesforce Remote Site Setting" src="http://shivasoft.in/blog/wp-content/uploads/2012/01/Salesforce-Remote-Site-Setting.png" alt="Salesforce Remote Site Setting" width="475" height="173" /></a><p class="wp-caption-text">Salesforce Remote Site Setting</p></div>
<p><span id="more-2624"></span><br />
It is possible that you may need to change first URL it may be <a href="https://www.na1-api.salesforce.com">https://www.na1-api.salesforce.com</a> or <a href="https://www.na2-api.salesforce.com">https://www.na2-api.salesforce.com</a></p>
<p>This application will prompt for the Username and Password of the other salesforce account and display the 10 records of the Account.</p>
<div id="attachment_2626" class="wp-caption aligncenter" style="width: 485px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/01/Connect-Other-Salesforce-Account.png"><img class=" wp-image-2626    " title="Connect Other Salesforce Account - Output Screen" src="http://shivasoft.in/blog/wp-content/uploads/2012/01/Connect-Other-Salesforce-Account.png" alt="Connect Other Salesforce Account - Output Screen" width="475" height="236" /></a><p class="wp-caption-text">Connect Other Salesforce Account - Output Screen</p></div>
<p><strong>Apex Code:</strong></p>
<pre class="brush: java; title: ; notranslate">
public with sharing class FetchAccount {

    //Login Domain May be test, prerellogin.pre
    String LOGIN_DOMAIN = 'www';
    public String pwd{get;set;}
    public String userName{get;set;}
    public List&lt;Account&gt; acc{get;set;}
    public String errMsg{get;set;}
    public String displayError{get;set;}

    public FetchAccount()
    {
        displayError = 'none';
    }

    public void fetch()
    {
        errMsg  = 'Some error occurred, please try again';
        try
        {
        //-----------------------------------
        // Login via SOAP/XML web service api
        //-----------------------------------
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://' + LOGIN_DOMAIN + '.salesforce.com/services/Soap/u/22.0');
        request.setMethod('POST');
        request.setHeader('Content-Type', 'text/xml;charset=UTF-8');
        request.setHeader('SOAPAction', '&quot;&quot;');
        //not escaping username and password because we're setting those variables above
        //in other words, this line &quot;trusts&quot; the lines above
        //if username and password were sourced elsewhere, they'd need to be escaped below
        request.setBody('&lt;Envelope xmlns=&quot;http://schemas.xmlsoap.org/soap/envelope/&quot;&gt;&lt;Header/&gt;&lt;Body&gt;&lt;login xmlns=&quot;urn:partner.soap.sforce.com&quot;&gt;&lt;username&gt;' + userName+ '&lt;/username&gt;&lt;password&gt;' + pwd+ '&lt;/password&gt;&lt;/login&gt;&lt;/Body&gt;&lt;/Envelope&gt;');
        Dom.XmlNode resultElmt = (new Http()).send(request).getBodyDocument().getRootElement()
          .getChildElement('Body', 'http://schemas.xmlsoap.org/soap/envelope/')
          .getChildElement('loginResponse', 'urn:partner.soap.sforce.com')
          .getChildElement('result', 'urn:partner.soap.sforce.com');

        //-------------------------------
        // Grab session id and server url
        //--------------------------------
        final String SERVER_URL = resultElmt.getChildElement('serverUrl', 'urn:partner.soap.sforce.com') .getText().split('/services')[0];
        final String SESSION_ID = resultElmt.getChildElement('sessionId', 'urn:partner.soap.sforce.com') .getText();

        //----------------------------------
        // Load first 10 accounts via REST API
        //---------------------------------
        final PageReference theUrl = new PageReference(SERVER_URL + '/services/data/v22.0/query/');
        theUrl.getParameters().put('q','Select a.Phone, a.Name, a.CreatedBy.FirstName, a.CreatedById From Account a limit 10');
        request = new HttpRequest();
        request.setEndpoint(theUrl.getUrl());
        request.setMethod('GET');
        request.setHeader('Authorization', 'OAuth ' + SESSION_ID);

        String body = (new Http()).send(request).getBody();

        JSONParser parser = JSON.createParser(body);

        do{
            parser.nextToken();
        }while(parser.hasCurrentToken() &amp;&amp; !'records'.equals(parser.getCurrentName()));

        parser.nextToken();

        acc = (List&lt;Account&gt;) parser.readValueAs(List&lt;Account&gt;.class);
        }
        catch(Exception e)
        {
            displayError = 'block';
        }

    }
}
</pre>
<p><strong>Visualforce Code:</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:page controller=&quot;FetchAccount&quot; standardStylesheets=&quot;true&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
.errorMsg{
    font-size:0.8 em;
    color:red;
}
&lt;/style&gt;
&lt;apex:pageBlock &gt;
&lt;apex:form &gt;
&lt;apex:outputLabel value=&quot;UserName : &quot; for=&quot;userName&quot;/&gt;
&lt;apex:inputText required=&quot;true&quot; id=&quot;userName&quot; value=&quot;{!userName}&quot; /&gt;
&lt;br /&gt;
&lt;apex:outputLabel value=&quot;Password : &quot; for=&quot;pwd&quot;/&gt;
&lt;apex:inputsecret id=&quot;pwd&quot; value=&quot;{!pwd}&quot;/&gt;
&lt;br /&gt;
&lt;apex:commandButton id=&quot;getRecords&quot; value=&quot;Get Records&quot; action=&quot;{!fetch}&quot; rerender=&quot;wrapper&quot; status=&quot;waitStatus&quot; /&gt;
&lt;apex:actionStatus startText=&quot;Requesting...&quot; stopText=&quot;&quot; id=&quot;waitStatus&quot;/&gt;
&lt;hr /&gt;
&lt;apex:outputPanel id=&quot;wrapper&quot;&gt;
&lt;div class=&quot;errorMsg&quot; style=&quot;display:{!displayError}&quot;&gt; {!errMsg} &lt;/div&gt;
&lt;apex:pageBlockTable value=&quot;{!acc}&quot; var=&quot;account&quot; id=&quot;accTable&quot; rowClasses=&quot;odd,even&quot; styleClass=&quot;tableClass&quot;&gt;

    &lt;apex:column &gt;
        &lt;apex:facet name=&quot;header&quot;&gt;Account Name&lt;/apex:facet&gt;
         &lt;apex:outputText value=&quot;{!account.name}&quot;/&gt;
    &lt;/apex:column&gt;

    &lt;apex:column &gt;
        &lt;apex:facet name=&quot;header&quot;&gt;Created By&lt;/apex:facet&gt;
         &lt;apex:outputText value=&quot;{!account.CreatedBy.FirstName}&quot;/&gt;
    &lt;/apex:column&gt;

    &lt;apex:column &gt;
        &lt;apex:facet name=&quot;header&quot;&gt;Phone&lt;/apex:facet&gt;
         &lt;apex:outputText value=&quot;{!account.Phone}&quot;/&gt;
    &lt;/apex:column&gt;

&lt;/apex:pageBlockTable&gt;
&lt;/apex:outputPanel&gt;
&lt;/apex:form&gt;
&lt;/apex:pageBlock&gt;
&lt;/apex:page&gt;
</pre>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/passing-parameter-in-actionfunction-in-visualforce/' rel='bookmark' title='Passing multiple Parameters in ActionFunction in Visualforce'>Passing multiple Parameters in ActionFunction in Visualforce</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/dynamic-approval-process-based-on-the-apex-and-trigger/' rel='bookmark' title='Dynamic Approval Process in Salesforce based on the Apex and Trigger'>Dynamic Approval Process in Salesforce based on the Apex and Trigger</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/very-useful-tips-and-tricks-of-the-apex-salesforce-interview-questions-part-4/' rel='bookmark' title='Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex'>Latest Salesforce Interview Questions &#8211; Part 4 &#8211; Related to Dynamic Apex</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/getting-record-from-one-salesforce-organization-to-other/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>What is IaaS, PaaS and SaaS in Cloud computing</title>
		<link>http://shivasoft.in/blog/salesforce/what-is-iaas-paas-and-saas-in-cloud-computing/</link>
		<comments>http://shivasoft.in/blog/salesforce/what-is-iaas-paas-and-saas-in-cloud-computing/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 17:54:05 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Salesforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2620</guid>
		<description><![CDATA[Explain the term IaaS, PaaS and SaaS in Cloud computing
No related posts.]]></description>
			<content:encoded><![CDATA[<p>This blog entry is too late and the reason of writing this article is, lots of time i got question like “<strong>What is Cloud Computing?</strong>”<br />
So here, every term of cloud computing is explained.</p>
<p><strong>Cloud Computing :</strong></p>
<p>In simple words it is the application on the remote server and to access it you will need the internet access and browser.<br />
<span style="text-decoration: underline;">Examples</span> : Gmail,Yahoo Mail &#8211; Email on remote server not on your local system.</p>
<p>It may be possible that you have virtual server (Server at remote place) or development environment at remote place. This is also included under term &#8220;Cloud Computing&#8221;.</p>
<div id="attachment_2621" class="wp-caption aligncenter" style="width: 410px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/01/What-is-Cloud-computing.png"><img class="size-full wp-image-2621" title="What is Cloud Computing" src="http://shivasoft.in/blog/wp-content/uploads/2012/01/What-is-Cloud-computing.png" alt="What is Cloud Computing" width="400" height="362" /></a><p class="wp-caption-text">What is Cloud Computing</p></div>
<hr />
<p><span id="more-2620"></span><br />
<strong>IaaS</strong> stands for <strong>Infrastructure as a service</strong> :<br />
In this type of service, you will get the Virtual System which can be connected using internet. Where you can install any Software even in some service providers you can install the operating system. You can get the root level of access to the server. System admins are mainly benefited because of no hardware maintenance and overhead.<br />
<span style="text-decoration: underline;">Example</span> &#8211; Amazon ECS and Rackspace Cloud</p>
<hr />
<p><strong>PaaS</strong> stands for <strong>Platform as a service :</strong><br />
In this type of service, you get development platform bundled with all the types of software preinstalled. You will then have to write and execute all your codes in remote server by some mechanism. Normally you will get the sandbox to program and test your applications. In this type of mechanism you cannot get the root level of access to the remote server. Servers will normally follow the multitenant architect where same server used by multiple organizations. It’s preferred by the developers who want to quickly start the development on particular technology without worrying about the hardware and underlying technology framework installations.<br />
<span style="text-decoration: underline;">Example</span> – Heroku and force.com both belongs to Salesforce</p>
<hr />
<p><strong>SaaS</strong> stands for <strong>Software as a service</strong><br />
This is the highest level of service in which everything is provided from hardware to software to already build applications.<br />
<span style="text-decoration: underline;">Example</span> – Salesforce.com used for the CRM already have bunch of applications build.</p>
<p>No related posts.</p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/what-is-iaas-paas-and-saas-in-cloud-computing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing multiple Parameters in ActionFunction in Visualforce</title>
		<link>http://shivasoft.in/blog/salesforce/passing-parameter-in-actionfunction-in-visualforce/</link>
		<comments>http://shivasoft.in/blog/salesforce/passing-parameter-in-actionfunction-in-visualforce/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 19:30:38 +0000</pubDate>
		<dc:creator>jitendra</dc:creator>
				<category><![CDATA[Salesforce]]></category>
		<category><![CDATA[Visualforce]]></category>

		<guid isPermaLink="false">http://shivasoft.in/blog/?p=2643</guid>
		<description><![CDATA[Example and Source code of  multiple Parameters  Parameter in ActionFunction in Visualforce - Salesforce
Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/get-dom-elementid-of-the-visualforce-components/' rel='bookmark' title='Get DOM ElementID of the Visualforce components'>Get DOM ElementID of the Visualforce components</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/how-to-host-s-control-in-visualforce-page/' rel='bookmark' title='How to Host S-Control in Visualforce Page'>How to Host S-Control in Visualforce Page</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/json-output-in-visualforce/' rel='bookmark' title='JSON output in Visualforce'>JSON output in Visualforce</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p style="text-align: justify;">Calling Apex Method from the Visualforce page is the one of the most required functionality in application development in Salesforce. <strong>&lt;apex:actionFunction&gt;</strong> is one of the method used to achieve this functionality.</p>
<p style="text-align: justify;">Most often we need to supply the arguments in <strong>&lt;apex:actionFunction&gt;</strong> and in this article I will demonstrate the way in which we can pass one or more than one parameter.<br />
The output of the example will be like below screen.</p>
<div id="attachment_2647" class="wp-caption aligncenter" style="width: 366px"><a href="http://shivasoft.in/blog/wp-content/uploads/2012/01/Passing-Parameter-in-ActionFunction-in-Visualforce.png"><img class="size-full wp-image-2647" title="Passing Parameter in ActionFunction in Visualforce" src="http://shivasoft.in/blog/wp-content/uploads/2012/01/Passing-Parameter-in-ActionFunction-in-Visualforce.png" alt="Passing Parameter in ActionFunction in Visualforce" width="356" height="176" /></a><p class="wp-caption-text">Passing Parameter in ActionFunction in Visualforce</p></div>
<p>Create Apex class with following code:<span id="more-2643"></span></p>
<pre class="brush: java; title: ; notranslate">
public with sharing class PassParameterActionFunction {
    public String val{get;set;}
    public String enteredText1{get;set;}
    public String enteredText2{get;set;}

    public void echoVal()
    {
     val = 'You have entered : 1 - '+enteredText1+' 2 -'+enteredText2;
    }
}
</pre>
<p>In above code, the variables “<strong>enteredText1</strong>” and “<strong>enteredText2</strong>” will be the parameters supplied by the javascript and variable “<strong>val</strong>” will display the concatenated result.<br />
Now create the Visualforce page with code:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:page controller=&quot;PassParameterActionFunction&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
.pointer
{
    cursor:pointer;
    border:1px solid #ccc;
    padding:5px;
}
&lt;/style&gt;
&lt;apex:form id=&quot;frm&quot;&gt;
&lt;apex:outputPanel id=&quot;resultPanel&quot;&gt;
&lt;apex:actionStatus startText=&quot;requesting...&quot; stopText=&quot;&quot; id=&quot;myStatus&quot; /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;apex:outputLabel value=&quot;{!val}&quot; /&gt;&lt;/b&gt;
&lt;/apex:outputPanel&gt;
&lt;br /&gt;
Enter Value 1 :
&lt;apex:inputText id=&quot;txt1&quot; /&gt;
&lt;br /&gt;
Enter Value 2 :
&lt;apex:inputText id=&quot;txt2&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;pointer&quot; onclick=&quot;callActionMethod()&quot;&gt; Click Me !!! &lt;/span&gt;

&lt;apex:actionFunction name=&quot;echo&quot; action=&quot;{!echoVal}&quot; reRender=&quot;resultPanel&quot; status=&quot;myStatus&quot;&gt;
&lt;apex:param name=&quot;firstParam&quot; assignTo=&quot;{!enteredText1}&quot; value=&quot;&quot; /&gt;
&lt;apex:param name=&quot;secondParam&quot; assignTo=&quot;{!enteredText2}&quot; value=&quot;&quot; /&gt;
&lt;/apex:actionFunction&gt;
&lt;/apex:form&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function callActionMethod()
{
 var txtVal1 = document.getElementById(&quot;{!$Component.frm.txt1}&quot;).value;
 var txtVal2 = document.getElementById(&quot;{!$Component.frm.txt2}&quot;).value;
 /*Below Method is generated by &quot;apex:actionFunction&quot; which will call Apex Method &quot;echoVal&quot; */
 echo(txtVal1,txtVal2);
}
&lt;/script&gt;

&lt;/apex:page&gt;
</pre>
<p style="text-align: justify;">The below code snippet is used to define the “<strong>actionFunction</strong>” in visual force page.<br />
To supply the parameter, we have to use “<strong>apex:param</strong>” tag. Attribute “<strong>assignTo</strong>” will assign the parameter to variable name specified in Apex code. Here we have assigned the value to variable “<strong>enteredText1</strong>” and “<strong>enteredText2</strong>”.</p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:actionFunction name=&quot;echo&quot; action=&quot;{!echoVal}&quot; reRender=&quot;resultPanel&quot; status=&quot;myStatus&quot;&gt;
&lt;apex:param name=&quot;firstParam&quot; assignTo=&quot;{!enteredText1}&quot; value=&quot;&quot; /&gt;
&lt;apex:param name=&quot;secondParam&quot; assignTo=&quot;{!enteredText2}&quot; value=&quot;&quot; /&gt;
&lt;/apex:actionFunction&gt;
</pre>
<p>The resulting JavaScript function created by the visualforce will be “<strong>echo</strong>” because we have set that name for the “<strong>apex:actionFunction</strong>”.<br />
Attribute “<strong>action</strong>” will call the method specified on Apex class and “<strong>status</strong>” will show the Ajax request status.<br />
Below JavaScript method is used to call the generated method by “<strong>apex:actionFunction</strong>”.</p>
<pre class="brush: jscript; title: ; notranslate">
function callActionMethod()
{
 var txtVal1 = document.getElementById(&quot;{!$Component.frm.txt1}&quot;).value;
 var txtVal2 = document.getElementById(&quot;{!$Component.frm.txt2}&quot;).value;
 /*Below Method is generated by &quot;apex:actionFunction&quot; which will call Apex Method &quot;echoVal&quot; */
 echo(txtVal1,txtVal2);
}
</pre>
<p>As you can see that we have called the method &#8220;<strong>echo</strong>&#8221; with two arguments, because in &#8220;<strong>apex:actionFunction</strong>&#8221; we have specified the parameters for the method.</p>
<hr />
<p><strong>Method 2:</strong></p>
<p>In this method, instead of creating two temporary variable in Apex page and assigning it using attribute &#8220;<strong>assignTo</strong>&#8220; of we can directly get the value in Apex code by something like using</p>
<pre class="brush: csharp; title: ; notranslate">
Apexpages.currentPage().getParameters().get('paramName');
</pre>
<p>So the resultant <strong>Apex code</strong> will be:</p>
<pre class="brush: csharp; title: ; notranslate">
public with sharing class PassParameterActionFunction {
    public String val{get;set;}

    public void echoVal()
    {
     val = 'You have entered : 1 - '+Apexpages.currentPage().getParameters().get('firstParam')+' 2 -'+Apexpages.currentPage().getParameters().get('secondParam');
    }
}
</pre>
<p><strong>Visualforce code:</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;apex:page controller=&quot;PassParameterActionFunction&quot;&gt;
&lt;style type=&quot;text/css&quot;&gt;
.pointer
{
    cursor:pointer;
    border:1px solid #ccc;
    padding:5px;
}
&lt;/style&gt;
&lt;apex:form id=&quot;frm&quot;&gt;
&lt;apex:outputPanel id=&quot;resultPanel&quot;&gt;
&lt;apex:actionStatus startText=&quot;requesting...&quot; stopText=&quot;&quot; id=&quot;myStatus&quot; /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;apex:outputLabel value=&quot;{!val}&quot; /&gt;&lt;/b&gt;
&lt;/apex:outputPanel&gt;
&lt;br /&gt;
Enter Value 1 :
&lt;apex:inputText id=&quot;txt1&quot; /&gt;
&lt;br /&gt;
Enter Value 2 :
&lt;apex:inputText id=&quot;txt2&quot; /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;pointer&quot; onclick=&quot;callActionMethod()&quot;&gt; Click Me !!! &lt;/span&gt;

&lt;apex:actionFunction name=&quot;echo&quot; action=&quot;{!echoVal}&quot; reRender=&quot;resultPanel&quot; status=&quot;myStatus&quot;&gt;
&lt;apex:param name=&quot;firstParam&quot;  value=&quot;&quot; /&gt;
&lt;apex:param name=&quot;secondParam&quot;  value=&quot;&quot; /&gt;
&lt;/apex:actionFunction&gt;
&lt;/apex:form&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function callActionMethod()
{
 var txtVal1 = document.getElementById(&quot;{!$Component.frm.txt1}&quot;).value;
 var txtVal2 = document.getElementById(&quot;{!$Component.frm.txt2}&quot;).value;
 /*Below Method is generated by &quot;apex:actionFunction&quot; which will call Apex Method &quot;echoVal&quot; */
 echo(txtVal1,txtVal2);
}
&lt;/script&gt;

&lt;/apex:page&gt;
</pre>
<p>Possibly Related posts:<ol>
<li><a href='http://shivasoft.in/blog/salesforce/get-dom-elementid-of-the-visualforce-components/' rel='bookmark' title='Get DOM ElementID of the Visualforce components'>Get DOM ElementID of the Visualforce components</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/how-to-host-s-control-in-visualforce-page/' rel='bookmark' title='How to Host S-Control in Visualforce Page'>How to Host S-Control in Visualforce Page</a></li>
<li><a href='http://shivasoft.in/blog/salesforce/json-output-in-visualforce/' rel='bookmark' title='JSON output in Visualforce'>JSON output in Visualforce</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://shivasoft.in/blog/salesforce/passing-parameter-in-actionfunction-in-visualforce/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

