tag:blogger.com,1999:blog-17160736874044778102024-03-29T00:05:57.491-07:00Technology Share - TechShareIT Technical blog. Shows latest articles on web technologies. Generally focusing Salesforce in various ways. Useful for end users as well as developers to make new tools.Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.comBlogger67125tag:blogger.com,1999:blog-1716073687404477810.post-70823832808965220632015-10-05T05:05:00.001-07:002015-10-05T05:06:42.966-07:00Visualforce Mashup - AngularJS and Bootstrap<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />
Here is a new blog post from my collegue on AngularJS, Bootstrap and Visualforce. You will get some cool knowledge about how to make a demo with these adhoc web technologies. Please check full post here:<br />
<br />
<br />
<style>
.read-more {
background: #f86e7d none repeat scroll 0 0;
color: #ffffff;
display: table;
float: left;
font-size: 13px;
height: 32px;
line-height: 32px;
padding: 6px 38px;
text-transform: uppercase;
}
</style>
<a class="read-more" href="http://ibirdstechshare.blogspot.in/2015/10/visualforce-demo-angularjs-bootstrap.html">Read More</a>
</div>Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com14tag:blogger.com,1999:blog-1716073687404477810.post-54815897159472410672015-09-15T23:26:00.000-07:002015-09-15T23:26:23.814-07:00Salesforce Visualforce Signature Tool<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />
This is a simple demo which will guide you to create a form with
"Signature Canvas" to take initials from user and stores that in
document and also displays it in a PDF file. It can be used for initials
in an Agreement, Terms and Condition, Authorized Person and various
other places...<br />
<br />
<style>
.read-more {
background: #f86e7d none repeat scroll 0 0;
color: #ffffff;
display: table;
float: left;
font-size: 13px;
height: 32px;
line-height: 32px;
padding: 6px 38px;
text-transform: uppercase;
}
</style>
<a class="read-more" href="http://ibirdstechshare.blogspot.in/2015/09/salesforce-visualforce-signature-tool.html">Read More</a>
</div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com11tag:blogger.com,1999:blog-1716073687404477810.post-12788216262328865392014-05-20T23:54:00.002-07:002014-05-20T23:54:35.604-07:00Salesforce Context Menu for list views<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="text-align: left;">
Hi All,</div>
<div style="text-align: left;">
This is a quick demo for a utility component. I designed it for standard salesforce list views. Its a kind of context menu which can be opened on clicking of a IMAGE formula field. You can show your useful menu options in this context menu. Each option can have the record id automatically by JS, so that your target page or screen can have proper processing based on passed record id.</div>
<div style="text-align: left;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAfINSHdRWHWVzYPRplXX2JwM_gomsMh0PrIZA-sPXKQKDz-7pK1U6TA28bDs6xxDGJzsbBsnmqWG-TZjzX44pyOElrKMsE1ZoxpYK-pnHV39PgbpbgRebHRwiwZ1Z1SKQagfuqZEUXD4/s1600/option-menu.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAfINSHdRWHWVzYPRplXX2JwM_gomsMh0PrIZA-sPXKQKDz-7pK1U6TA28bDs6xxDGJzsbBsnmqWG-TZjzX44pyOElrKMsE1ZoxpYK-pnHV39PgbpbgRebHRwiwZ1Z1SKQagfuqZEUXD4/s1600/option-menu.png" height="243" width="640" /></a></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<span style="font-size: large;">How to configure:</span></div>
<ol style="text-align: left;">
<li>Make a IMAGE formula field as given in screeshot above</li>
<li>Upload the menu-resources.zip file available on this url<br /> <a href="http://www.aslambari.com/downloads/menu-resources.zip" target="_blank">http://www.aslambari.com/downloads/menu-resources.zip</a></li>
<li>Make one home page component (HTML type and Narrow side)</li>
<li>Put below code in that component</li>
</ol>
<div id="iframeDiv2adeac80-5d58-4662-8e48-7235c36ffe40" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframe2adeac80-5d58-4662-8e48-7235c36ffe40" src="http://www.blogtrog.com/code.aspx?id=2adeac80-5d58-4662-8e48-7235c36ffe40" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDiv2adeac80-5d58-4662-8e48-7235c36ffe40" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: green;"><!--</span><span style="color: green;"> include files </span><span style="color: green;">--></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">script </span><span style="color: red;">src</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/jquery.min.js"</span><span style="color: blue;">></</span><span style="color: maroon;">script</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">link </span><span style="color: red;">rel</span><span style="color: blue;">="stylesheet"</span><span style="color: red;"> href</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/menu.css"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: green;"><!--</span><span style="color: green;"> HTML Menu </span><span style="color: green;">--></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">div </span><span style="color: red;">class</span><span style="color: blue;">="dropdown-menu"</span><span style="color: red;"> id</span><span style="color: blue;">="dropdown-menu"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="/003?rlid=RelatedContactList&amp;id="</span><span style="color: red;"> target</span><span style="color: blue;">="_BLANK"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">img </span><span style="color: red;">src</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/application_view_detail.png"</span><span style="color: red;"> </span><span style="color: blue;">/></span><span style="color: black;">
Sync Contacts
</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="/006?rlid=RelatedOpportunityList&amp;id="</span><span style="color: red;"> target</span><span style="color: blue;">="_BLANK"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">img </span><span style="color: red;">src</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/calendar-disabled.png"</span><span style="color: blue;">></span><span style="color: black;">
Export Orders</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="/005?rlid=RelatedCaseList&amp;id="</span><span style="color: red;"> target</span><span style="color: blue;">="_BLANK"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">img </span><span style="color: red;">src</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/zip.png"</span><span style="color: blue;">/></span><span style="color: black;">
View Cases
</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">div </span><span style="color: red;">class</span><span style="color: blue;">="break"</span><span style="color: blue;">></</span><span style="color: maroon;">div</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="/_ui/core/chatter/ui/ChatterPage"</span><span style="color: red;"> target</span><span style="color: blue;">="_BLANK"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">img </span><span style="color: red;">src</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/connect_light_small_short.gif"</span><span style="color: blue;">/></span><span style="color: black;">
Sync Feeds</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="00T?rlid=RelatedActivityList&amp;id="</span><span style="color: red;"> target</span><span style="color: blue;">="_BLANK"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">img </span><span style="color: red;">src</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/phone.png"</span><span style="color: blue;">/></span><span style="color: black;">
Calls History
</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="/002?parent_id=001900000054UZ7&amp;id="</span><span style="color: red;"> target</span><span style="color: blue;">="_BLANK"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">img </span><span style="color: red;">src</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/3668432.png"</span><span style="color: blue;">/></span><span style="color: black;">
Box.Net Documents
</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="00T?rlid=RelatedActivityList&amp;id="</span><span style="color: red;"> target</span><span style="color: blue;">="_BLANK"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">img </span><span style="color: red;">src</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/feature_gmail_icon.gif"</span><span style="color: blue;">/></span><span style="color: black;">
Google Mails
</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">div </span><span style="color: red;">class</span><span style="color: blue;">="break"</span><span style="color: blue;">></</span><span style="color: maroon;">div</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="00T?rlid=RelatedActivityList&amp;id="</span><span style="color: red;"> target</span><span style="color: blue;">="_BLANK"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">img </span><span style="color: red;">src</span><span style="color: blue;">="/resource/1400648652000/dupedetector__menu_resources/menu-resources/delete.png"</span><span style="color: blue;">/></span><span style="color: black;">
Delete Logs
</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">div</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: green;"><!--</span><span style="color: green;"> JS Part </span><span style="color: green;">--></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">script</span><span style="color: blue;">></span><span style="background-color: whitesmoke; color: black;">
</span><span style="background-color: whitesmoke; color: blue;">function</span><span style="background-color: whitesmoke; color: black;"> init_sfdc_menu(){
$(</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">.x-grid3-col-00N9000000A4pIp</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">).click(</span><span style="background-color: whitesmoke; color: blue;">function</span><span style="background-color: whitesmoke; color: black;">(event){
event.stopPropagation();
</span><span style="background-color: whitesmoke; color: blue;">var</span><span style="background-color: whitesmoke; color: black;"> id </span><span style="background-color: whitesmoke; color: black;">=</span><span style="background-color: whitesmoke; color: black;"> $(</span><span style="background-color: whitesmoke; color: blue;">this</span><span style="background-color: whitesmoke; color: black;">).attr(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">id</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">).split(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">_</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">)[</span><span style="background-color: whitesmoke; color: black;">0</span><span style="background-color: whitesmoke; color: black;">];
$(</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">.dropdown-menu</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">).css( {position:</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">absolute</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">, top:event.pageY</span><span style="background-color: whitesmoke; color: black;">-</span><span style="background-color: whitesmoke; color: black;">100</span><span style="background-color: whitesmoke; color: black;">, left: event.pageX</span><span style="background-color: whitesmoke; color: black;">-</span><span style="background-color: whitesmoke; color: black;">30</span><span style="background-color: whitesmoke; color: black;">});
$(</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">.dropdown-menu</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">).find(</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">a</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">).each(</span><span style="background-color: whitesmoke; color: blue;">function</span><span style="background-color: whitesmoke; color: black;">(){
</span><span style="background-color: whitesmoke; color: blue;">var</span><span style="background-color: whitesmoke; color: black;"> oldhref </span><span style="background-color: whitesmoke; color: black;">=</span><span style="background-color: whitesmoke; color: black;"> $(</span><span style="background-color: whitesmoke; color: blue;">this</span><span style="background-color: whitesmoke; color: black;">).attr(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">href</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">);
oldhref </span><span style="background-color: whitesmoke; color: black;">=</span><span style="background-color: whitesmoke; color: black;"> oldhref.substring(</span><span style="background-color: whitesmoke; color: black;">0</span><span style="background-color: whitesmoke; color: black;">,oldhref.lastIndexOf(</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">=</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">)</span><span style="background-color: whitesmoke; color: black;">+</span><span style="background-color: whitesmoke; color: black;">1</span><span style="background-color: whitesmoke; color: black;">);
$(</span><span style="background-color: whitesmoke; color: blue;">this</span><span style="background-color: whitesmoke; color: black;">).attr(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">href</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">, oldhref </span><span style="background-color: whitesmoke; color: black;">+</span><span style="background-color: whitesmoke; color: black;"> id);
});
$(</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">.dropdown-menu</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">).show();
});
$(document).click(</span><span style="background-color: whitesmoke; color: blue;">function</span><span style="background-color: whitesmoke; color: black;">(){
$(</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">.dropdown-menu</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">).hide();
});
}
$(document).ready(</span><span style="background-color: whitesmoke; color: blue;">function</span><span style="background-color: whitesmoke; color: black;">(e) {
$(</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">#bodyCell</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">).bind(</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">DOMNodeInserted DOMNodeRemoved</span><span style="background-color: whitesmoke; color: black;">'</span><span style="background-color: whitesmoke; color: black;">, </span><span style="background-color: whitesmoke; color: blue;">function</span><span style="background-color: whitesmoke; color: black;">(event) {
setTimeout(init_sfdc_menu(),</span><span style="background-color: whitesmoke; color: black;">500</span><span style="background-color: whitesmoke; color: black;">);
});
});
</span><span style="color: blue;"></</span><span style="color: maroon;">script</span><span style="color: blue;">></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('2adeac80-5d58-4662-8e48-7235c36ffe40');</script>
<br />
<ol style="text-align: left;">
</ol>
<span style="font-size: large;">Changes:</span><br />
I have designed this component for just showing how to use this utility, so i have not make it very robust or optimize and have left few hard coded ids few places, but any developer who needs to make it work proper, needs to do following changes in files:<br />
<ol style="text-align: left;">
</ol>
<ul style="text-align: left;">
<li> Open the menu.css and change hard coded id "00N9000000A4pIp" to your image formula field id on list view</li>
<li> Change the same id available on component code</li>
<li> Once you uploaded your static resource, you will get one timestamp for that which you can see in my component code few places, you need to change it with yours as well and make sure you provide proper url, for example my url for jquery.js is this:</li>
</ul>
<div style="text-align: left;">
<i>"/resource/1400648652000/dupedetector__menu_resources/menu-resources/jquery.min.js"</i></div>
<div style="text-align: left;">
You need to change this url with yours.</div>
<div style="text-align: left;">
</div>
<div style="text-align: left;">
Here is a screencast you can see how it works.</div>
<div style="text-align: left;">
<iframe frameborder="0" height="454" scrolling="no" src="//screencast-o-matic.com/embed?sc=c2hr1qnzQV&w=800&v=3" width="800"></iframe>
</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Email if for any issue, happy coding :)</div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Thanks</div>
<div style="text-align: left;">
Aslam Bari<br />
http://www.aslambari.com </div>
</div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com12tag:blogger.com,1999:blog-1716073687404477810.post-79963246845459263492013-09-12T23:50:00.002-07:002013-09-12T23:50:35.658-07:00Simple JavaScript Salesforce Validation - jSFValidation<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />Today I am going to give a demo for JS validation for VF pages which works mostly like native SFDC field validation. Here you can find the working demo. <br /><br /><a href="http://labsprojects-developer-edition.ap1.force.com/jSFValidationDemo" target="_blank">http://labsprojects-developer-edition.ap1.force.com/jSFValidationDemo</a><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib-x_OTjjCfddomn1c64PocXbSISKAH0KBqJC-4kBQqXJxDxPJya0h2kW1uGaR19uSva0fhwpHN1dk94EGaXEjlbNOmi3Pqs3iUdmevWOd5mKfSyzgR7mJQXBJH2aMjDly70_p_5hagkQ/s1600/jSF+Validation+Salesforce.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="313" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEib-x_OTjjCfddomn1c64PocXbSISKAH0KBqJC-4kBQqXJxDxPJya0h2kW1uGaR19uSva0fhwpHN1dk94EGaXEjlbNOmi3Pqs3iUdmevWOd5mKfSyzgR7mJQXBJH2aMjDly70_p_5hagkQ/s400/jSF+Validation+Salesforce.jpg" width="400" /></a></div>
<br />
<br />Right now i have implemented the validation for "Required" type. If any text box values are empty , i am adding the error. You simply need to add the jSFValidation component and then you need to add the class "jSF_Required" on the fields you want to add validation for. In given demo, only "Mailing Country" is not required. Rest of the fields are marked for required.<br /><br />You can download the code from here.<br /><a href="http://www.aslambari.com/downloads/jSFValidation.zip" target="_blank">http://www.aslambari.com/downloads/jSFValidation.zip</a><br /><br /><br />Provide your suggestions to improve this :)<br /><br />Thanks<br />Aslam Bari</div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com12tag:blogger.com,1999:blog-1716073687404477810.post-87561757693239626192013-03-18T06:37:00.001-07:002013-03-18T06:37:44.536-07:00Salesforce, Google Map 3 and jQuery with Clusters<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />
In past i have posted one blog regarding google map, using jquery and google map version 2. Now since, google have version 3 so i have upgraded my plugin with latest version and also used more featured jquery plugin i found which is <a href="http://gmap3.net/en/" target="_blank">gMap3</a>. You can check it here:<br />
<a href="http://gmap3.net/en/" target="_blank">http://gmap3.net/en/</a><br />
<br />
I recommend you first refer my earlier version of google map component <a href="http://techsahre.blogspot.in/2011/04/sfgmap-salesforce-google-map-jquery.html" target="_blank">here</a>:<br />
<a href="http://techsahre.blogspot.in/2011/04/sfgmap-salesforce-google-map-jquery.html" target="_blank">http://techsahre.blogspot.in/2011/04/sfgmap-salesforce-google-map-jquery.html</a><br />
<br />
I used this jQuery plugin and implemented my own new version of sfGmap, called <b>sfGmap3</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8hGwz5JUbykN91j3VZ101sUKTMnBxSQXmMZqaZGzDnzdchUKwdf9E9WeL0H086-4w3iu4NFbG7k99MX8V6pOAgeX5L1gBMDeBlszjdNOc-0J_qLjcyiVNh7QKFW5bRTUolr0QjQUr6w/s1600/rajasthan-historical-places.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="448" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiO8hGwz5JUbykN91j3VZ101sUKTMnBxSQXmMZqaZGzDnzdchUKwdf9E9WeL0H086-4w3iu4NFbG7k99MX8V6pOAgeX5L1gBMDeBlszjdNOc-0J_qLjcyiVNh7QKFW5bRTUolr0QjQUr6w/s640/rajasthan-historical-places.png" width="640" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiTJw7eZaA4zbaNbDzuhlXQSOv3KfIBtxj2OGc_Jv-VBFYUus8yoyNHvpg6-cqvmFo8YwtQ1GFZE4FOJB37FuXVgGE3cqlR1q9yvxYTgq3hyC5DCMsvD2A8sQqROxA_fvcBIRnwqbR_64/s1600/ajmer-dargah-khwaja-sahab.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
<b> </b>This component has all features like previous component but have one more new feature called <b>Clusters</b>. You can turn On and Off this feature in my component using attribute "<b>useCluster</b>".<br />
<br />
Here is a basic usage of this component:<br />
<c:sfgmap3 addressmodel="{!addressmodel}" height="500px" usecluster="true" uselatlng="false" width="100%" zoom="2" /> <br />
<br />
I used this plugin and created one demo to show historical places in Rajasthan. Thanks to my collegue Rajendar Rathore, who helped me to make database for these places which included lat, long, pictures etc. Here the link for online demo:<br />
<br />
<a href="http://labsprojects-developer-edition.ap1.force.com/GMapRajasthanPlaces" target="_blank">http://labsprojects-developer-edition.ap1.force.com/GMapRajasthanPlaces</a><br />
<br />
You can see each cluster is identified by a image, i used Camel image. Once you zoom in, you will keep go inside the cluster and finally you can find the actual place. You can click on each marker and you can find a info window containing image of that place and name like below.<br />
<br /></div>
<br />
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiTJw7eZaA4zbaNbDzuhlXQSOv3KfIBtxj2OGc_Jv-VBFYUus8yoyNHvpg6-cqvmFo8YwtQ1GFZE4FOJB37FuXVgGE3cqlR1q9yvxYTgq3hyC5DCMsvD2A8sQqROxA_fvcBIRnwqbR_64/s1600/ajmer-dargah-khwaja-sahab.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjiTJw7eZaA4zbaNbDzuhlXQSOv3KfIBtxj2OGc_Jv-VBFYUus8yoyNHvpg6-cqvmFo8YwtQ1GFZE4FOJB37FuXVgGE3cqlR1q9yvxYTgq3hyC5DCMsvD2A8sQqROxA_fvcBIRnwqbR_64/s320/ajmer-dargah-khwaja-sahab.png" width="310" /> </a></div>
<br />
Hope you will like it. Mail me for full code of this demo and let me know suggestions to improve it as always.<br />
<br />
Thanks<br />
Aslam Bari<br />
http://www.aslambari.com
</div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com23tag:blogger.com,1999:blog-1716073687404477810.post-50445521533044203722013-03-10T21:04:00.001-07:002013-03-10T21:04:49.974-07:00Extend Salesforce Rich Text Editor as Multi-Purpose<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />
Recently one of client wants some enhancement to existing 'Send Email' screen. They want some functionalities which standard email editor does not support and even salesforce Rich Text Editor also does not support.<br />
I did some research and found that we can extend standard salesforce Rich Text Editor in many ways. One of the enhancement which I did, I am going to show you all.<br />
<br />
Client wants a way to fetch all related contacts and opportunities from current account in the email editor on the place he wants and editable and also wants to control as many times as he needed. To achieve this task, I came up with the custom button solution which can be embedded into standard Rich Text Area of salesforce and can attach some event handlers to them.<br />
<br />
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj11KGhbzdr_sd0JOdkm7XfHf4PWV7UcBuyAD6TqnO1Yyg6q5D_NRPL7c8clv1cJH4KTlcwf5gSmD4g0SPci6VXAOoG97_N7xSRLdUIVnlLnQYR10Zq9kgaxWOH-HQFSrbsahAM5Te7R4/s1600/Extend-Rich-Text-Editor-Salesforce.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="230" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj11KGhbzdr_sd0JOdkm7XfHf4PWV7UcBuyAD6TqnO1Yyg6q5D_NRPL7c8clv1cJH4KTlcwf5gSmD4g0SPci6VXAOoG97_N7xSRLdUIVnlLnQYR10Zq9kgaxWOH-HQFSrbsahAM5Te7R4/s400/Extend-Rich-Text-Editor-Salesforce.png" width="400" /></a></div>
<br />
I created one component called "AddButtonToolbar". In this component, for demo purpose i have created two custom buttons for showContacts and showOpportunities. But you can make as many as you want. Here is the basic configuration you can do:<br />
<br />
<div id="iframeDivdaa6858d-88a4-481e-bad4-e75661d0963c" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframedaa6858d-88a4-481e-bad4-e75661d0963c" src="http://www.blogtrog.com/code.aspx?id=daa6858d-88a4-481e-bad4-e75661d0963c" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDivdaa6858d-88a4-481e-bad4-e75661d0963c" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: black;"><</span><span style="color: black;">apex:component</span><span style="color: black;">></span><span style="color: black;">
</span><span style="color: black;"><</span><span style="color: black;">apex:attribute name</span><span style="color: black;">=</span><span style="color: black;">"</span><span style="color: black;">accountId</span><span style="color: black;">"</span><span style="color: black;"> type</span><span style="color: black;">=</span><span style="color: black;">"</span><span style="color: black;">string</span><span style="color: black;">"</span><span style="color: black;"> description</span><span style="color: black;">=</span><span style="color: black;">"</span><span style="color: black;">passed account id</span><span style="color: black;">"/</span><span style="color: black;">></span><span style="color: black;">
</span><span style="color: black;"> </span><span style="color: black;"><</span><span style="color: black;">script src</span><span style="color: black;">=</span><span style="color: black;">"</span><span style="color: black;">{!URLFOR($Resource.ckeditor,'ckeditor/jquery-1.4.2.min.js')}</span><span style="color: black;">"</span><span style="color: black;">><</span><span style="color: black;">/</span><span style="color: black;">script></span><span style="color: black;">
</span><span style="color: black;"> </span><span style="color: black;"><</span><span style="color: black;">script</span><span style="color: black;">></span><span style="color: black;">
</span><span style="color: green;">//</span><span style="color: green;">Event Handler for ShowContacts button </span><span style="color: green;">
</span><span style="color: black;"> </span><span style="color: green;">//</span><span style="color: green;">Fetch and prepares the contact table in editor</span><span style="color: green;">
</span><span style="color: black;"> </span><span style="color: blue;">function</span><span style="color: black;"> showContacts(){
</span><span style="color: green;">//</span><span style="color: green;"> invoke your sfdc method here</span><span style="color: green;">
</span><span style="color: black;"> }
</span><span style="color: green;">//</span><span style="color: green;">Event Handler for ShowOpportunities button</span><span style="color: green;">
</span><span style="color: black;"> </span><span style="color: green;">//</span><span style="color: green;">Fetch and show the opportunities in RTE</span><span style="color: green;">
</span><span style="color: black;"> </span><span style="color: blue;">function</span><span style="color: black;"> showOpportunities(){
</span><span style="color: green;">//</span><span style="color: green;"> invoke your sfdc method here</span><span style="color: green;">
</span><span style="color: black;"> }
</span><span style="color: green;">/*</span><span style="color: green;">***
Custom buttons configuration
Provide name, label, command (js function), and Image for the button
</span><span style="color: green;">*/</span><span style="color: black;">
</span><span style="color: blue;">var</span><span style="color: black;"> config </span><span style="color: black;">=</span><span style="color: black;"> {
</span><span style="color: black;">"</span><span style="color: black;">Buttons</span><span style="color: black;">"</span><span style="color: black;">: [
{
</span><span style="color: black;">"</span><span style="color: black;">Name</span><span style="color: black;">"</span><span style="color: black;"> : </span><span style="color: black;">"</span><span style="color: black;">Contacts</span><span style="color: black;">"</span><span style="color: black;">,
</span><span style="color: black;">"</span><span style="color: black;">Label</span><span style="color: black;">"</span><span style="color: black;"> : </span><span style="color: black;">"</span><span style="color: black;">Show Contacts</span><span style="color: black;">"</span><span style="color: black;">,
</span><span style="color: black;">"</span><span style="color: black;">Command</span><span style="color: black;">"</span><span style="color: black;">: </span><span style="color: black;">"</span><span style="color: black;">showContacts</span><span style="color: black;">"</span><span style="color: black;">,
</span><span style="color: black;">"</span><span style="color: black;">Image</span><span style="color: black;">"</span><span style="color: black;">: </span><span style="color: black;">"</span><span style="color: black;">{!URLFOR($Resource.ckeditor,'ckeditor/plugins/timestamp/images/16-cube-green.png')}</span><span style="color: black;">"</span><span style="color: black;">
},
{</span><span style="color: black;">"</span><span style="color: black;">Name</span><span style="color: black;">"</span><span style="color: black;"> : </span><span style="color: black;">"</span><span style="color: black;">Opportunities</span><span style="color: black;">"</span><span style="color: black;">,
</span><span style="color: black;">"</span><span style="color: black;">Label</span><span style="color: black;">"</span><span style="color: black;"> : </span><span style="color: black;">"</span><span style="color: black;">Show Opportunities</span><span style="color: black;">"</span><span style="color: black;">,
</span><span style="color: black;">"</span><span style="color: black;">Command</span><span style="color: black;">"</span><span style="color: black;">: </span><span style="color: black;">"</span><span style="color: black;">showOpportunities</span><span style="color: black;">"</span><span style="color: black;">,
</span><span style="color: black;">"</span><span style="color: black;">Image</span><span style="color: black;">"</span><span style="color: black;">: </span><span style="color: black;">"</span><span style="color: black;">{!URLFOR($Resource.ckeditor,'ckeditor/plugins/timestamp/images/contact.png')}</span><span style="color: black;">"</span><span style="color: black;">
}
]
}
</span><span style="color: blue;">function</span><span style="color: black;"> initialize(){
</span><span style="color: blue;">for</span><span style="color: black;">(</span><span style="color: blue;">var</span><span style="color: black;"> i</span><span style="color: black;">=</span><span style="color: black;">0</span><span style="color: black;">; i</span><span style="color: black;"><</span><span style="color: black;">config.Buttons.length;i</span><span style="color: black;">++</span><span style="color: black;">){
addButton(config.Buttons[i].Name,
config.Buttons[i].Image,
config.Buttons[i].Command,
config.Buttons[i].Label);
}
}
</span><span style="color: blue;">function</span><span style="color: black;"> addButton(name,image,command,label){
$(</span><span style="color: black;">'</span><span style="color: black;">#cke_21</span><span style="color: black;">'</span><span style="color: black;">).append(</span><span style="color: black;">'</span><span style="color: black;"><span class="cke_toolbar_start"></span></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;"><span role="presentation" class="cke_toolgroup"></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;"><span class="cke_button"></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;"><a onclick="</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">command</span><span style="color: black;">+</span><span style="color: black;">'</span><span style="color: black;">();" onblur="this.style.cssText = this.style.cssText;" role="button" hidefocus="true" title="</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">label</span><span style="color: black;">+</span><span style="color: black;">'</span><span style="color: black;">" class="cke_button_outdent cke_disabled" id="</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">name</span><span style="color: black;">+</span><span style="color: black;">'</span><span style="color: black;">" aria-disabled="true"></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;"><span class="cke_icon" style="background-image:url(</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">image</span><span style="color: black;">+</span><span style="color: black;">'</span><span style="color: black;">);background-position:center;">&nbsp;</span></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;"><span class="cke_label" id="</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">name</span><span style="color: black;">+</span><span style="color: black;">'</span><span style="color: black;">"></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">label</span><span style="color: black;">+</span><span style="color: black;">'</span><span style="color: black;"></span></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;"></a></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;"></span></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;"></span></span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;"><span class="cke_toolbar_end"></span></span><span style="color: black;">'</span><span style="color: black;">
);
}
</span><span style="color: blue;">var</span><span style="color: black;"> defaultFunc </span><span style="color: black;">=</span><span style="color: black;"> window.onload;
window.onload </span><span style="color: black;">=</span><span style="color: black;"> </span><span style="color: blue;">function</span><span style="color: black;">() {
</span><span style="color: blue;">if</span><span style="color: black;">(defaultFunc)
defaultFunc ();
setTimeout(</span><span style="color: black;">"</span><span style="color: black;">initialize()</span><span style="color: black;">"</span><span style="color: black;">,</span><span style="color: black;">1000</span><span style="color: black;">);
}
</span><span style="color: black;"><</span><span style="color: black;">/</span><span style="color: black;">script> </span><span style="color: black;">
</span><span style="color: black;"><</span><span style="color: black;">/</span><span style="color: black;">apex:component></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('daa6858d-88a4-481e-bad4-e75661d0963c');</script>
<br />
Line #21-#35 shows configuration option for your buttons.<br />
initialize() method starts creating the buttons.<br />
<br />
Here is a working demo for above functionality:<br />
<a href="http://labsprojects-developer-edition.ap1.force.com/ExtendRTE?id=001900000054UZ7" target="_blank">http://labsprojects-developer-edition.ap1.force.com/ExtendRTE?id=001900000054UZ7</a> <br />
<br />
You will see two buttons on right side. Click on those buttons to see things in action.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj11KGhbzdr_sd0JOdkm7XfHf4PWV7UcBuyAD6TqnO1Yyg6q5D_NRPL7c8clv1cJH4KTlcwf5gSmD4g0SPci6VXAOoG97_N7xSRLdUIVnlLnQYR10Zq9kgaxWOH-HQFSrbsahAM5Te7R4/s1600/Extend-Rich-Text-Editor-Salesforce.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
Additionaliy you can put your email address and try to send email to your account to see how email will look.<br />
<br />
Mail me for full code as always :)<br />
<br />
Thanks<br />
Aslam Bari</div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com24tag:blogger.com,1999:blog-1716073687404477810.post-46352964075487623442013-02-27T07:37:00.000-08:002013-02-27T17:41:07.754-08:00Salesforce Remoting & jQuery Drag/Drop Mash-up<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk97VntwZ3XqJf0J-ksx-te4nS3wVwO8InUg_KItLszKkQUJ72_D4V9L1ZodhorF59XY9jvvlX3OZKG7FgkvuOSofO_mDl6Sp-lt_al3YwNvkxx4geMoTJdm5OJp0PDseY3_v1SCoNrI0/s1600/Task-Assignment-Dashboard.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
Hi All,<br />
Today I am going to show you a good useful mash-up using jQuery Drag/Drop feature with Salesforce Remoting. I have created a simple application where user can see a Dashboard where all Un-Assigned tasks are shown on left side. All available contacts will be available on right side.<br />
Now, user can drag any task from left side list and drop on right side, for any contact. Internally the Task will be assigned to that particular Contact. This is done internally using Salesforce Remoting.<br />
This type of applications are very convenient to use and do the work smoothly.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk97VntwZ3XqJf0J-ksx-te4nS3wVwO8InUg_KItLszKkQUJ72_D4V9L1ZodhorF59XY9jvvlX3OZKG7FgkvuOSofO_mDl6Sp-lt_al3YwNvkxx4geMoTJdm5OJp0PDseY3_v1SCoNrI0/s1600/Task-Assignment-Dashboard.png" style="margin-left: 1em; margin-right: 1em;"><img alt="" border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhk97VntwZ3XqJf0J-ksx-te4nS3wVwO8InUg_KItLszKkQUJ72_D4V9L1ZodhorF59XY9jvvlX3OZKG7FgkvuOSofO_mDl6Sp-lt_al3YwNvkxx4geMoTJdm5OJp0PDseY3_v1SCoNrI0/s640/Task-Assignment-Dashboard.png" title="" width="640" /></a></div>
<br />
<br />
You can test the application here.<br />
<a href="http://labsprojects-developer-edition.ap1.force.com/TaskAssignmentDashboard" target="_blank">http://labsprojects-developer-edition.ap1.force.com/TaskAssignmentDashboard</a><br />
<br />
Here are few assumptions/points regarding above demo;<br />
<br />
1) I have used Contacts to assign the Task but actually we must use Users<br />
2) I have given demo for Tasks, but we can use this application for other useful things like Cases, Leads and Opportunity assignments<br />
3) The demo actually will not update the records in database. I have commented actual database update because of demo purpose. You can only check the drag and drop and assignments.<br />
<br />
Mail me if you need the code for above demo.<br />
<br />
Your suggestions to improve this app , are always appreciated.<br />
<br />
Thanks<br />
Aslam Bari</div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com142tag:blogger.com,1999:blog-1716073687404477810.post-84822194483791970522013-02-12T07:22:00.000-08:002013-02-12T07:24:51.311-08:00Salesforce JQuery Mobile Demo<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPmeuB6lUk0LxfHND4lNtI2BH21ivDSiDCPO59MbY40V6B94flrxHc7K-WI7QJTuduhew_CYpYucNbQOSa2deWtHwddqcEjHNtT9CtQAC9-dQm2nE0l8mV-MkaixA7LjG-NSy2Q1RfEHY/s1600/jquery-mobile-sfdc-demo.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
Hi All,<br />
Here I am going to show you a demo of jQuery Mobile development which is using Salesforce Sites. Its very easy and convinient to integrate both technologies which is natively compatible with your mobile. It comes with a very cool native look and feel UI, responsive UI themes and APIs. With couple of tags you can build up your site compatible with multiple devices.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPmeuB6lUk0LxfHND4lNtI2BH21ivDSiDCPO59MbY40V6B94flrxHc7K-WI7QJTuduhew_CYpYucNbQOSa2deWtHwddqcEjHNtT9CtQAC9-dQm2nE0l8mV-MkaixA7LjG-NSy2Q1RfEHY/s1600/jquery-mobile-sfdc-demo.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhPmeuB6lUk0LxfHND4lNtI2BH21ivDSiDCPO59MbY40V6B94flrxHc7K-WI7QJTuduhew_CYpYucNbQOSa2deWtHwddqcEjHNtT9CtQAC9-dQm2nE0l8mV-MkaixA7LjG-NSy2Q1RfEHY/s320/jquery-mobile-sfdc-demo.png" width="245" /></a></div>
<br />
<br />
Here is a working demo. I am showing contact list from salesforce. You can search contacts. You can click any contact to see the detail.<br />
<a href="http://labsprojects-developer-edition.ap1.force.com/JQMContacts" target="_blank">http://labsprojects-developer-edition.ap1.force.com/JQMContacts</a><br />
<br />
Open web browser in your mobile phone and open the above url to see in action. <br />
<br />
If you need source code for above, drop me an email: aslam.bari@gmail.com<br />
<br />
Thanks<br />
Aslam Bari</div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com19tag:blogger.com,1999:blog-1716073687404477810.post-65842093112335671002013-02-06T23:40:00.000-08:002013-02-06T23:40:21.494-08:00Salesforce Calendar Component - SFC<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />
Recently I had a requirement where a client wanted to show complete year calendar on page with following requirements.<br />
<br />
1) We can pass any year to calendar and it must print the complete year (12 month) calendar<br />
2) It must have provision to highlight the holidays<br />
3) It must be printed or saved or emailed as PDF also<br />
<br />
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMvVWcaqesQbiR8BtTbNwG6aXr2YxPgClVZtigNdaqYnC5JriX9PwqH2nbQHKqg6Bu5wSo-pCfUSMdlF35cKRhDYgRkjQG3ft_ShrCXIR-EbgLOlr5kinaY8y5VUYtl1ukVwkJ1pNSIfY/s1600/sfc-component.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="75" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMvVWcaqesQbiR8BtTbNwG6aXr2YxPgClVZtigNdaqYnC5JriX9PwqH2nbQHKqg6Bu5wSo-pCfUSMdlF35cKRhDYgRkjQG3ft_ShrCXIR-EbgLOlr5kinaY8y5VUYtl1ukVwkJ1pNSIfY/s200/sfc-component.png" width="200" /></a></div>
To achieve it, i first find the jQuery UI DatePicker best fit. But there is a issue with this approach. JS does not work properly when we do RenderAs pdf in vf pages. So, this approach will not work.<br />
Then finally I come up with my own solution by making native salesforce approach - SFC Component. Feature for this are as below:<br />
<br />
1) We can pass the component year and month<br />
2) We can pass the component holidays list as well<br />
<br />
<br />
Here is the syntax how you can use this:<br />
<br />
<div id="iframeDiv9cf7809e-58f9-4248-8bdf-b0e200e79d1f" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframe9cf7809e-58f9-4248-8bdf-b0e200e79d1f" src="http://www.blogtrog.com/code.aspx?id=9cf7809e-58f9-4248-8bdf-b0e200e79d1f" style="border: 1px solid #e0e0e0; height: 50px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDiv9cf7809e-58f9-4248-8bdf-b0e200e79d1f" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: blue;"><</span><span style="color: maroon;">c:SFC_MonthComponent </span><span style="color: red;">month</span><span style="color: blue;">="7"</span><span style="color: red;"> year</span><span style="color: blue;">="2013"</span><span style="color: blue;">/></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('9cf7809e-58f9-4248-8bdf-b0e200e79d1f');</script>
<br />
Above syntax will print July, 2013 calendar<br />
<br />
<div id="iframeDiv9f76845d-4375-4c00-9269-79dd296a986a" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframe9f76845d-4375-4c00-9269-79dd296a986a" src="http://www.blogtrog.com/code.aspx?id=9f76845d-4375-4c00-9269-79dd296a986a" style="border: 1px solid #e0e0e0; height: 50px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDiv9f76845d-4375-4c00-9269-79dd296a986a" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: blue;"><</span><span style="color: maroon;">c:SFC_MonthComponent </span><span style="color: red;">month</span><span style="color: blue;">="7"</span><span style="color: red;"> year</span><span style="color: blue;">="2013"</span><span style="color: red;"> holidays</span><span style="color: blue;">="25,30"</span><span style="color: blue;">/></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('9f76845d-4375-4c00-9269-79dd296a986a');</script>
<br />
Above syntax will print July, 2013 calendar. In addition it will also highlight the 25th and 30th of the month as holidays<br />
<br />
You can download the code from here:<br />
<a href="http://www.aslambari.com/salesforce_calendar.html" target="_blank">http://www.aslambari.com/salesforce_calendar.html</a><br />
<br />
You can see the working demo here<br />
<a href="http://labsprojects-developer-edition.ap1.force.com/FullYearCalendar?year=2013" target="_blank">http://labsprojects-developer-edition.ap1.force.com/FullYearCalendar?year=2013</a><br />
<br />
You can change the year parameter from url to see the calendar for different years on the above demo. For demo purpose i have highlighted few dates as holidays (orange color).<br />
<br />
In the code, i have used some styles for printing calendar like holidays highlight. You can simply change those style to match up your theme.</div>
</div>
</div>
<br />
<br />
The above code is for version 1. As this is native vf/apex, you can simply use "renderAs=pdf" to get the output in PDF format.<br />
<br />
In next version , here is my plan to enhance it with following features.<br />
<br />
1) Different preset of themes for styling the calendar component<br />
2) Give Event feature for clicking on any date. You can do different operations on that click of any date<br />
<br />
As always, your suggestions are welcome to enhance this tool<br />
<br />
<br />
Thanks<br />
Aslam Bari
</div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com9tag:blogger.com,1999:blog-1716073687404477810.post-87488622329497634312013-01-18T06:10:00.001-08:002013-01-18T06:33:22.403-08:00Simple jQuery Dependent Picklist<div dir="ltr" style="text-align: left;" trbidi="on">
<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAyyGjdBwxI5JoPPqVebb9j91thq9c_epDKd_aJcpfNLeLOZPFJ8V960PDpU6pB_-t3MLGptC6WMzDy6YIh1P1gLULIODJ3efNYlNA0KB-_HrbTt478gRatkCosk_Gi-6ZJOj0-sGuYSc/s1600/dependent.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
Hi All,<br />
Today I am going to show you how to make dependent picklist on visualforce page with some few lines of code. This is client side dependent list. So it has following benefits:<br />
<br />
1) No Action Function or Ajax, means we dont need to call server side script to filter the list of records.<br />
2) Its based on javascript so its fast<br />
3) We can extend the level of dependency<br />
<br />
<br />
<div style="text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAyyGjdBwxI5JoPPqVebb9j91thq9c_epDKd_aJcpfNLeLOZPFJ8V960PDpU6pB_-t3MLGptC6WMzDy6YIh1P1gLULIODJ3efNYlNA0KB-_HrbTt478gRatkCosk_Gi-6ZJOj0-sGuYSc/s1600/dependent.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="102" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAyyGjdBwxI5JoPPqVebb9j91thq9c_epDKd_aJcpfNLeLOZPFJ8V960PDpU6pB_-t3MLGptC6WMzDy6YIh1P1gLULIODJ3efNYlNA0KB-_HrbTt478gRatkCosk_Gi-6ZJOj0-sGuYSc/s400/dependent.png" width="400" /></a></div>
<br />
The idea here to use jQuery and one small method to make the dependency. I have got this idea from <a href="http://ajaxray.com/blog/javascript-controlled-dependent-or-cascading-select-list">here</a>.<br />
1) First make your parent select list as below<br />
<br />
<div id="iframeDiv4202dca3-c389-4f21-8e88-2bf8a4c11283" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframe4202dca3-c389-4f21-8e88-2bf8a4c11283" src="http://www.blogtrog.com/code.aspx?id=4202dca3-c389-4f21-8e88-2bf8a4c11283" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDiv4202dca3-c389-4f21-8e88-2bf8a4c11283" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: black;"> </span><span style="color: blue;"><</span><span style="color: maroon;">select </span><span style="color: red;">id</span><span style="color: blue;">="accountList"</span><span style="color: red;"> size</span><span style="color: blue;">="1"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">option </span><span style="color: red;">value</span><span style="color: blue;">=""</span><span style="color: blue;">></span><span style="color: black;">-Select-</span><span style="color: blue;"></</span><span style="color: maroon;">option</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">apex:repeat </span><span style="color: red;">value</span><span style="color: blue;">="{!accounts}"</span><span style="color: red;"> var</span><span style="color: blue;">="acc"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">option </span><span style="color: red;">value</span><span style="color: blue;">="{!acc.Id}"</span><span style="color: blue;">></span><span style="color: black;">{!acc.Name}</span><span style="color: blue;"></</span><span style="color: maroon;">option</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">apex:repeat</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">select</span><span style="color: blue;">></span><span style="color: black;">
</span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('4202dca3-c389-4f21-8e88-2bf8a4c11283');</script>
2) Make your child select list. Make sure to give option a class name like this "child_{parent_record_value}". <br />
<br /></div>
<br />
<div id="iframeDiv24fbf875-f0fa-41f1-9080-d1863ce57918" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframe24fbf875-f0fa-41f1-9080-d1863ce57918" src="http://www.blogtrog.com/code.aspx?id=24fbf875-f0fa-41f1-9080-d1863ce57918" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDiv24fbf875-f0fa-41f1-9080-d1863ce57918" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: black;"> </span><span style="color: blue;"><</span><span style="color: maroon;">select </span><span style="color: red;">id</span><span style="color: blue;">="contactList"</span><span style="color: red;"> size</span><span style="color: blue;">="1"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">apex:repeat </span><span style="color: red;">value</span><span style="color: blue;">="{!contacts}"</span><span style="color: red;"> var</span><span style="color: blue;">="con"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">option </span><span style="color: red;">class</span><span style="color: blue;">="child_{!con.accountid}"</span><span style="color: red;"> value</span><span style="color: blue;">="{!con.Id}"</span><span style="color: blue;">></span><span style="color: black;">{!con.Name}</span><span style="color: blue;"></</span><span style="color: maroon;">option</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">apex:repeat</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">select</span><span style="color: blue;">></span><span style="color: black;">
</span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('24fbf875-f0fa-41f1-9080-d1863ce57918');</script>
3) Put the below code in your head section<br />
<br />
<div id="iframeDiv4ed32059-ad03-46b3-b2a2-04d50061743d" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframe4ed32059-ad03-46b3-b2a2-04d50061743d" src="http://www.blogtrog.com/code.aspx?id=4ed32059-ad03-46b3-b2a2-04d50061743d" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDiv4ed32059-ad03-46b3-b2a2-04d50061743d" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: black;"> </span><span style="color: blue;">function</span><span style="color: black;"> prepareList(parent,child,isSubselectOptional){
$(</span><span style="color: black;">"</span><span style="color: black;">body</span><span style="color: black;">"</span><span style="color: black;">).append(</span><span style="color: black;">"</span><span style="color: black;"><select style='display:none' id='</span><span style="color: black;">"</span><span style="color: black;">+</span><span style="color: black;">parent</span><span style="color: black;">+</span><span style="color: black;">child</span><span style="color: black;">+</span><span style="color: black;">"</span><span style="color: black;">'></select></span><span style="color: black;">"</span><span style="color: black;">);
$(</span><span style="color: black;">'</span><span style="color: black;">#</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">parent</span><span style="color: black;">+</span><span style="color: black;">child).html($(</span><span style="color: black;">"</span><span style="color: black;">#</span><span style="color: black;">"</span><span style="color: black;">+</span><span style="color: black;">child</span><span style="color: black;">+</span><span style="color: black;">"</span><span style="color: black;"> option</span><span style="color: black;">"</span><span style="color: black;">));
$(</span><span style="color: black;">'</span><span style="color: black;">#</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">child).html(</span><span style="color: black;">"</span><span style="color: black;"><option> — </option></span><span style="color: black;">"</span><span style="color: black;">);
$(</span><span style="color: black;">'</span><span style="color: black;">#</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">parent).change(</span><span style="color: blue;">function</span><span style="color: black;">(){
</span><span style="color: blue;">var</span><span style="color: black;"> parentValue </span><span style="color: black;">=</span><span style="color: black;"> $(</span><span style="color: black;">'</span><span style="color: black;">#</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">parent).attr(</span><span style="color: black;">'</span><span style="color: black;">value</span><span style="color: black;">'</span><span style="color: black;">);
$(</span><span style="color: black;">'</span><span style="color: black;">#</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">child).html($(</span><span style="color: black;">"</span><span style="color: black;">#</span><span style="color: black;">"</span><span style="color: black;">+</span><span style="color: black;">parent</span><span style="color: black;">+</span><span style="color: black;">child</span><span style="color: black;">+</span><span style="color: black;">"</span><span style="color: black;"> .child_</span><span style="color: black;">"</span><span style="color: black;">+</span><span style="color: black;">parentValue).clone());
</span><span style="color: blue;">if</span><span style="color: black;">(isSubselectOptional) $(</span><span style="color: black;">'</span><span style="color: black;">#</span><span style="color: black;">'</span><span style="color: black;">+</span><span style="color: black;">child).prepend(</span><span style="color: black;">"</span><span style="color: black;"><option> — Select — </option></span><span style="color: black;">"</span><span style="color: black;">);
});
}</span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('4ed32059-ad03-46b3-b2a2-04d50061743d');</script>
4) Call the below method on load of the page. Make sure to pass proper parent and child select list ids.<br />
<div id="iframeDivc5481663-d2c9-4021-96ca-4d646c20ba06" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframec5481663-d2c9-4021-96ca-4d646c20ba06" src="http://www.blogtrog.com/code.aspx?id=c5481663-d2c9-4021-96ca-4d646c20ba06" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDivc5481663-d2c9-4021-96ca-4d646c20ba06" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: black;">$(</span><span style="color: blue;">function</span><span style="color: black;">() {
prepareList(</span><span style="color: black;">'</span><span style="color: black;">accountList</span><span style="color: black;">'</span><span style="color: black;">,</span><span style="color: black;">'</span><span style="color: black;">contactList</span><span style="color: black;">'</span><span style="color: black;">, </span><span style="color: blue;">false</span><span style="color: black;">);
});</span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('c5481663-d2c9-4021-96ca-4d646c20ba06');</script>
<br />
Thats it. Now you can see on the page the dependency is created automatically. <br />
<br />
You can download the code from <a href="http://www.aslambari.com/downloads/dependent_picklist.zip">here</a><br />
<br />
You can see the working demo here<br />
<a href="http://labsprojects-developer-edition.ap1.force.com/DependentPicklist">http://labsprojects-developer-edition.ap1.force.com/DependentPicklist</a> <br />
<br />
<br />
Thanks<br />
Aslam Bari
</div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com8tag:blogger.com,1999:blog-1716073687404477810.post-68836510301467390322013-01-01T23:57:00.000-08:002013-01-02T01:07:28.209-08:00Simple Context-Menu For Web Page<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="http://www.blogger.com/blogger.g?blogID=1716073687404477810" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"></a></div>
Hi All,<br />
Here I am going to give a demo for how you can make a context menu on your web page using few lines of code. Many times such web applications needed where user can do many operations on different kind of records. In that scenario making lot of buttons or checkboxes are easily avoided if you go with context menu.<br />
<br />
<br />
<div style="text-align: center;">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNhrMO1rasYUJz1WM2xFNv52g4B4jwMGfGv7wc7IiaMzSBN748Xwm_WewJ7CKtsALjuwCb9h7F8hKP6HQJF-oQtOZ5Qu_DGaYlKdG4gNhdLKZvsO1w73Dg09lOvsPfrHdEvPoBNjOYZAM/s1600/index.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img alt="Context-Menu" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNhrMO1rasYUJz1WM2xFNv52g4B4jwMGfGv7wc7IiaMzSBN748Xwm_WewJ7CKtsALjuwCb9h7F8hKP6HQJF-oQtOZ5Qu_DGaYlKdG4gNhdLKZvsO1w73Dg09lOvsPfrHdEvPoBNjOYZAM/s1600/index.png" title="Context-Menu" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNhrMO1rasYUJz1WM2xFNv52g4B4jwMGfGv7wc7IiaMzSBN748Xwm_WewJ7CKtsALjuwCb9h7F8hKP6HQJF-oQtOZ5Qu_DGaYlKdG4gNhdLKZvsO1w73Dg09lOvsPfrHdEvPoBNjOYZAM/s1600/index.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><br /></a></div>
</div>
<div style="text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<i>How to implement Context-Menu:</i><br />
<br />
1) <b>Make your context-menu html code and put that at the end of body.</b><br />
<br />
<div id="iframeDiv231fd270-de7e-4e86-9148-badd57041ee9" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframe231fd270-de7e-4e86-9148-badd57041ee9" src="http://www.blogtrog.com/code.aspx?id=231fd270-de7e-4e86-9148-badd57041ee9" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDiv231fd270-de7e-4e86-9148-badd57041ee9" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: blue;"><</span><span style="color: maroon;">ul </span><span style="color: red;">id</span><span style="color: blue;">="menu"</span><span style="color: red;"> class</span><span style="color: blue;">="custom-menu"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">li</span><span style="color: blue;">><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="javascript:alert('Clicked Add Notes');"</span><span style="color: red;"> onclick</span><span style="color: blue;">="addnote();"</span><span style="color: blue;">></span><span style="color: black;">Add Notes</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></</span><span style="color: maroon;">li</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">li</span><span style="color: blue;">><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="javascript:alert('Clicked Add Memos');"</span><span style="color: red;"> id</span><span style="color: blue;">="menu_2"</span><span style="color: blue;">></span><span style="color: black;">Add Memos</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></</span><span style="color: maroon;">li</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">hr </span><span style="color: red;">style</span><span style="color: blue;">="clear:both;color:#E6E6E6"</span><span style="color: red;"> </span><span style="color: blue;">/></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">li</span><span style="color: blue;">><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="javascript:alert('Clicked View Order');"</span><span style="color: red;"> id</span><span style="color: blue;">="menu_4"</span><span style="color: blue;">></span><span style="color: black;">View Order</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></</span><span style="color: maroon;">li</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">li</span><span style="color: blue;">><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="javascript:alert('Clicked View Invoice');"</span><span style="color: red;"> id</span><span style="color: blue;">="menu_5"</span><span style="color: blue;">></span><span style="color: black;">View Invoice</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></</span><span style="color: maroon;">li</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">li</span><span style="color: blue;">><</span><span style="color: maroon;">a </span><span style="color: red;">href</span><span style="color: blue;">="javascript:alert('Clicked View Employee');"</span><span style="color: red;"> id</span><span style="color: blue;">="menu_3"</span><span style="color: blue;">></span><span style="color: black;">View Employee</span><span style="color: blue;"></</span><span style="color: maroon;">a</span><span style="color: blue;">></</span><span style="color: maroon;">li</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">ul</span><span style="color: blue;">></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('231fd270-de7e-4e86-9148-badd57041ee9');</script>
<br />
2) <b>Include jQuery main js file, in our case i have used <a href="http://code.jquery.com/jquery-1.8.3.min.js">jquery-1.8.3.js</a></b><br />
<br />
3) <b>Put below code in your head section of html file</b><br />
<br />
<div id="iframeDiva8f91967-cdb2-4a5f-81b4-9b5a9be985d8" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframea8f91967-cdb2-4a5f-81b4-9b5a9be985d8" src="http://www.blogtrog.com/code.aspx?id=a8f91967-cdb2-4a5f-81b4-9b5a9be985d8" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDiva8f91967-cdb2-4a5f-81b4-9b5a9be985d8" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: blue;"><</span><span style="color: maroon;">script</span><span style="color: blue;">></span><span style="background-color: whitesmoke; color: black;">
$(</span><span style="background-color: whitesmoke; color: blue;">function</span><span style="background-color: whitesmoke; color: black;">() {
$(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">.emp</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">).bind(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">contextmenu</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">, </span><span style="background-color: whitesmoke; color: blue;">function</span><span style="background-color: whitesmoke; color: black;">(event) {
event.preventDefault();
$(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">#menu</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">).show();
$(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">#menu</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">).css({top: event.pageY </span><span style="background-color: whitesmoke; color: black;">+</span><span style="background-color: whitesmoke; color: black;"> </span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">px</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">, left: event.pageX </span><span style="background-color: whitesmoke; color: black;">+</span><span style="background-color: whitesmoke; color: black;"> </span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">px</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">});
});
$(document).bind(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">click</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">, </span><span style="background-color: whitesmoke; color: blue;">function</span><span style="background-color: whitesmoke; color: black;">(event) {
$(</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">#menu</span><span style="background-color: whitesmoke; color: black;">"</span><span style="background-color: whitesmoke; color: black;">).hide();
});
});
</span><span style="color: blue;"></</span><span style="color: maroon;">script</span><span style="color: blue;">></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('a8f91967-cdb2-4a5f-81b4-9b5a9be985d8');</script>
<br />
<br />
Here #menu is Id of your html menu area, ".emp" is the class name of element on which you want to bind this context-menu on right click. <br />
<br />
4) <b>Give some good look to your menu, put below code in your head section style tag</b><br />
<br />
<div id="iframeDivd50c0ce8-bfb3-47a2-b4ba-fcf0d173252b" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframed50c0ce8-bfb3-47a2-b4ba-fcf0d173252b" src="http://www.blogtrog.com/code.aspx?id=d50c0ce8-bfb3-47a2-b4ba-fcf0d173252b" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDivd50c0ce8-bfb3-47a2-b4ba-fcf0d173252b" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: blue;"><</span><span style="color: maroon;">style</span><span style="color: blue;">></span><span style="background-color: whitesmoke; color: maroon;">
.custom-menu </span><span style="background-color: whitesmoke; color: black;">{</span><span style="background-color: whitesmoke; color: red;">
z-index</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">1000</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
position</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;"> absolute</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
background-color</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">#FFF</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
border</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;"> 1px solid black</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
padding</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;"> 5px</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
list-style</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;"> none</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
width</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">150px</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
display</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">none</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
</span><span style="background-color: whitesmoke; color: black;">}</span><span style="background-color: whitesmoke; color: maroon;">
.custom-menu a</span><span style="background-color: whitesmoke; color: black;">{</span><span style="background-color: whitesmoke; color: red;">
text-decoration</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;"> none</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
padding</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">5px</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
font-size</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">13px</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
width</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">100px</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
display</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">block</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
color</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">#000</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
</span><span style="background-color: whitesmoke; color: black;">}</span><span style="background-color: whitesmoke; color: maroon;">
.custom-menu a:hover</span><span style="background-color: whitesmoke; color: black;">{</span><span style="background-color: whitesmoke; color: red;">
text-decoration</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;"> none</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
border</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">1px solid #ccc</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
background-color</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">greenyellow</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
</span><span style="background-color: whitesmoke; color: black;">}</span><span style="background-color: whitesmoke; color: maroon;">
.custom-menu li</span><span style="background-color: whitesmoke; color: black;">{</span><span style="background-color: whitesmoke; color: red;">
margin</span><span style="background-color: whitesmoke; color: black;">:</span><span style="background-color: whitesmoke; color: blue;">5px</span><span style="background-color: whitesmoke; color: black;">;</span><span style="background-color: whitesmoke; color: red;">
</span><span style="background-color: whitesmoke; color: black;">}</span><span style="background-color: whitesmoke; color: maroon;">
</span><span style="color: blue;"></</span><span style="color: maroon;">style</span><span style="color: blue;">></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('d50c0ce8-bfb3-47a2-b4ba-fcf0d173252b');</script>
<br />
<br />
5) Now, design your web page and give class "emp" to the elment where you want this context menu to open. <br />
<br />
Here is working demo:<br />
<a href="http://labs.aslambari.com/context-menu/contextmenu.html">http://labs.aslambari.com/context-menu/contextmenu.html</a><br />
Click the names of employee on the page, you will see the context-menu <br />
<br />
You can download complete code here:<br />
<a href="http://aslambari.com/downloads/context-menu.zip">http://aslambari.com/downloads/context-menu.zip</a><br />
<br />
Let me know your thoughts<br />
<br />
Thanks<br />
Aslam Bari<br />
<br />
<br />
<br /></div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com1tag:blogger.com,1999:blog-1716073687404477810.post-92181151177310165422012-10-11T04:53:00.000-07:002012-10-11T04:53:30.589-07:00Change Email Utility - Salesforce<div dir="ltr" style="text-align: left;" trbidi="on">
<!--[if gte mso 9]><xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
</o:OfficeDocumentSettings>
</xml><![endif]-->
<div class="MsoNormal" style="text-align: justify;">
Hi All,</div>
<div class="MsoNormal" style="text-align: justify;">
Here i am introducing one utility
created by me. It is used to change the email address of salesforce org. You
must have username, password and security token for the org. </div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz7Pqr6260E7L4slQF6q7VLGI83ljJxqRfzNZAho2BHiOgYtlqy6HmgQdbh-zWacIfPyQ26Ce9gDdkuG8Rq31S0mdpdXddD_rmUSbgQE3cJABvkz4gBcwGWUILOJK3NNzQQ4xOQQ2Homo/s1600/salesforce-email-utility.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz7Pqr6260E7L4slQF6q7VLGI83ljJxqRfzNZAho2BHiOgYtlqy6HmgQdbh-zWacIfPyQ26Ce9gDdkuG8Rq31S0mdpdXddD_rmUSbgQE3cJABvkz4gBcwGWUILOJK3NNzQQ4xOQQ2Homo/s320/salesforce-email-utility.png" width="320" /></a></div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #45818e;"><b>How to access utility?</b></span></div>
<div class="MsoNormal" style="text-align: justify;">
You can access this utility from my site, here is the url:</div>
<div class="MsoNormal" style="text-align: justify;">
<a href="http://www.aslambari.com/salesforce_email_utility/" target="_blank">http://www.aslambari.com/salesforce_email_utility/</a> </div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<span style="color: #45818e;"><b>Why and When you need this?</b></span></div>
<div class="MsoNormal" style="text-align: justify;">
I recently came across one
situation when i deadly need this utility. One of my colleague recently setup one new
salesforce org. He given his username, password, email for the org. He
completed his work and sent me details about username, password, security token
as well. After couple of hours, when i tried to login and test from my home, i
was unable to login because my IP is not white listed. I called my colleague, but
his phone was off, and its DEADLINE for me to give this info to client to show
him all the work. My IP was not white listed so i can't login, the email address
assigned to org was for my colleague , so i even can't get the activation code.
What to do?</div>
<div class="MsoNormal" style="text-align: justify;">
Then i thought to create this
utility.</div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
<b><span style="color: #45818e;">Benefits:</span></b></div>
<div class="MsoNormal" style="text-align: justify;">
You can change email address of
the user of the salesforce org. You must know username, password and security
token. This utility only send you a Email Change notification. You will get one
email. You can accept that verification email change. After that when you try to
login from browser using username and password, then you can easily get
verification code of the org as your email address is now changed for given
org.</div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
Let me know your thoughts on this
utility.</div>
<div class="MsoNormal" style="text-align: justify;">
<br /></div>
<div class="MsoNormal" style="text-align: justify;">
Thanks</div>
<div class="MsoNormal" style="text-align: justify;">
Aslam Bari</div>
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-US</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:EnableOpenTypeKerning/>
<w:DontFlipMirrorIndents/>
<w:OverrideTableStyleHps/>
</w:Compatibility>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin-top:0in;
mso-para-margin-right:0in;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0in;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
</style>
<![endif]--></div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com12tag:blogger.com,1999:blog-1716073687404477810.post-513633089016676692012-10-07T10:30:00.001-07:002012-10-07T10:32:07.777-07:00OAuth Token as Salesforce SessionId in SOAP API (PHP)<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />
Most of the time developers who write applications in php/java or any other language, using salesforce soap APIs (partner wsdl or enterprise wsdl), they hard-code the username/password and security token in their code or in a property file. But there is one issue in this approach, anytime, if your org password or security token get change, your application may down. You have to update the credentials in your code or property file on server to get your application work.<br />
<br />
One alternate solution for this issue is to use OAuth token in your code and write one automated code which will refresh your oauth token whenever it gets expired. The approach which i am going to tell in few moments has a benefit that you don't have to modify your code much. The place where you setting your sessionid, you just need to change that place, instead of getting sessionid from login method, you simply need to change with oauth token way.<br />
<br />
Here is a complete process to achieve this:<br />
<br />
<br />
1) Go to your org, Setup->Remote Access, make New remote access entry there for your application. Give return url for the file which will get oauth code returned. In my example, i used this url<br />
http://localhost/oauthsample/tokenprint.php<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNjcg1HIldRwM64UM8lYUdP9p05tOA0cVIKRst8xFnBeSFygCJo24132qYCRRj2WlkllTyewAqGO2PjuC8AGrDoPxA3_Y13W2jgKP8ClNC4kQyC5g6Buoa0XPj9gKEEXwkm-v3bgTScuE/s1600/oauth.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNjcg1HIldRwM64UM8lYUdP9p05tOA0cVIKRst8xFnBeSFygCJo24132qYCRRj2WlkllTyewAqGO2PjuC8AGrDoPxA3_Y13W2jgKP8ClNC4kQyC5g6Buoa0XPj9gKEEXwkm-v3bgTScuE/s400/oauth.png" width="400" /></a></div>
<br />
<br />
You will notice that you will get Consumer key and Consumer secret. <br />
<br />
2) Make one php file at this location oauthsample/tokenprint.php with below code. The purpose of this code is simply print the oauth code.<br />
<div id="iframeDivb5fe6778-e637-452b-93fc-bdf1dbe91325" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframeb5fe6778-e637-452b-93fc-bdf1dbe91325" src="http://www.blogtrog.com/code.aspx?id=b5fe6778-e637-452b-93fc-bdf1dbe91325" style="border: 1px solid #e0e0e0; height: 100px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDivb5fe6778-e637-452b-93fc-bdf1dbe91325" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: black;"><?</span><span style="color: black;">php
</span><span style="color: teal;">var_dump</span><span style="color: black;">(</span><span style="color: purple;">$_REQUEST</span><span style="color: black;">);
</span><span style="color: black;">?></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('b5fe6778-e637-452b-93fc-bdf1dbe91325');</script>
<br />
<br />
3) Now use your browser, prepare this url and invoke from address bar of browser<br />
<div id="iframeDivf0373d0b-7b59-44eb-b295-81e67ad8229f" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframef0373d0b-7b59-44eb-b295-81e67ad8229f" src="http://www.blogtrog.com/code.aspx?id=f0373d0b-7b59-44eb-b295-81e67ad8229f" style="border: 1px solid #e0e0e0; height: 100px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDivf0373d0b-7b59-44eb-b295-81e67ad8229f" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: black;">https</span><span style="color: black;">:</span><span style="color: green;">//</span><span style="color: green;">login.salesforce.com/services/oauth2/authorize?response_type=code&client_id=<your_consumer_key>&redirect_uri=http://localhost/oauthsample/tokenprint.php</span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('f0373d0b-7b59-44eb-b295-81e67ad8229f');</script>
<your_consumer_key><your_consumer_key><your_redirect_uri><your_redirect_uri><br /><br />As soon you invoke this url, you will see the generated oauth code on screen, copy the "GENERATED CODE" from the browser window.<br /><br />4) Now use following html code, run it in your browser, by simply double click, fill the values in each field.</your_redirect_uri></your_redirect_uri></your_consumer_key></your_consumer_key><br />
<br />
<div id="iframeDiv9ab31549-e4d3-4ceb-adc0-519cb859e29e" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframe9ab31549-e4d3-4ceb-adc0-519cb859e29e" src="http://www.blogtrog.com/code.aspx?id=9ab31549-e4d3-4ceb-adc0-519cb859e29e" style="border: 1px solid #e0e0e0; height: 400px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDiv9ab31549-e4d3-4ceb-adc0-519cb859e29e" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: blue;"><</span><span style="color: maroon;">form </span><span style="color: red;">method</span><span style="color: blue;">="post"</span><span style="color: red;"> action</span><span style="color: blue;">="https://login.salesforce.com/services/oauth2/token"</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">input </span><span style="color: red;">type</span><span style="color: blue;">="hidden"</span><span style="color: red;"> name</span><span style="color: blue;">="grant_type"</span><span style="color: red;"> value</span><span style="color: blue;">="authorization_code"</span><span style="color: blue;">/></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">table</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">tr</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
GENERATED CODE
</span><span style="color: blue;"></</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">input </span><span style="color: red;">type</span><span style="color: blue;">="text"</span><span style="color: red;"> name</span><span style="color: blue;">="code"</span><span style="color: red;"> </span><span style="color: blue;">/></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">tr</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">tr</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
CONSUMER KEY
</span><span style="color: blue;"></</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">input </span><span style="color: red;">type</span><span style="color: blue;">="text"</span><span style="color: red;"> name</span><span style="color: blue;">="client_id"</span><span style="color: red;"> value</span><span style="color: blue;">=""</span><span style="color: blue;">/></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">tr</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
CONSUMER SECRET
</span><span style="color: blue;"></</span><span style="color: maroon;">Td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">input </span><span style="color: red;">type</span><span style="color: blue;">="text"</span><span style="color: red;"> name</span><span style="color: blue;">="client_secret"</span><span style="color: red;"> value</span><span style="color: blue;">=""</span><span style="color: blue;">/></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">tr</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">tr</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
REDIRECT URL
</span><span style="color: blue;"></</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">input </span><span style="color: red;">type</span><span style="color: blue;">="text"</span><span style="color: red;"> name</span><span style="color: blue;">="redirect_uri"</span><span style="color: red;"> value</span><span style="color: blue;">="http://localhost/oauthsample/tokenprint.php"</span><span style="color: blue;">/></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">td</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">tr</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">table</span><span style="color: blue;">></span><span style="color: black;">
</span><span style="color: blue;"><</span><span style="color: maroon;">input </span><span style="color: red;">type</span><span style="color: blue;">="submit"</span><span style="color: red;"> </span><span style="color: blue;">/></span><span style="color: black;">
</span><span style="color: blue;"></</span><span style="color: maroon;">form</span><span style="color: blue;">></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('9ab31549-e4d3-4ceb-adc0-519cb859e29e');</script>
<your_consumer_key><your_redirect_uri></your_redirect_uri></your_consumer_key><br />
<your_consumer_key><your_redirect_uri></your_redirect_uri></your_consumer_key><br />
<your_consumer_key><your_redirect_uri></your_redirect_uri></your_consumer_key><br />
<your_consumer_key><your_redirect_uri></your_redirect_uri></your_consumer_key><br />
<your_consumer_key><your_redirect_uri></your_redirect_uri></your_consumer_key><br />
<your_consumer_key><your_redirect_uri><br /></your_redirect_uri></your_consumer_key>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1OiNcjAghY6xo-8Cz16pJqOS5BlK6Yp4u2w_lXNztsSu3QfO9Zpjh6-jiNk7TTL_7CopKQPCsUn2r-JxUHwre9wgkaCfDWr7I12kYZJ5FzoS6DK8nS4TZE1lIt7fBwj5p1a1c0CJLMVM/s1600/oauth-html.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="245" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1OiNcjAghY6xo-8Cz16pJqOS5BlK6Yp4u2w_lXNztsSu3QfO9Zpjh6-jiNk7TTL_7CopKQPCsUn2r-JxUHwre9wgkaCfDWr7I12kYZJ5FzoS6DK8nS4TZE1lIt7fBwj5p1a1c0CJLMVM/s400/oauth-html.png" width="400" /></a></div>
<your_consumer_key><your_redirect_uri><br /></your_redirect_uri></your_consumer_key>
<your_consumer_key><your_redirect_uri></your_redirect_uri></your_consumer_key><br />
<your_consumer_key><your_redirect_uri></your_redirect_uri></your_consumer_key><br />
<your_consumer_key><your_redirect_uri><br />5) After you execute this, you will get xml output on screen something like this:</your_redirect_uri></your_consumer_key><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlABD-EpIvoPML-PuI_g-DpaLYoWpMHP270h-8Z5jzVkaewNiEVEkZzWJfZVv6WgEPQ-1t6h7M9NJj_Qt1J8vMSMZU6KnHFceF_IBD4Uw5AOxaqKp7tSsyC56cfcnkT2-LpcpzaPtai6Y/s1600/oauthxml.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="125" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlABD-EpIvoPML-PuI_g-DpaLYoWpMHP270h-8Z5jzVkaewNiEVEkZzWJfZVv6WgEPQ-1t6h7M9NJj_Qt1J8vMSMZU6KnHFceF_IBD4Uw5AOxaqKp7tSsyC56cfcnkT2-LpcpzaPtai6Y/s400/oauthxml.png" width="400" /></a></div>
<br />
<your_consumer_key><your_redirect_uri><br /><br />Here you will get two important things, one Refresh Token and second "access token".<br /><br />6) Now, in your PHP/Java code you need to replace your session id with this access token. There is another thing in your code "server url", this you need to hard code something like below (make sure to use instance url of your org) :
</your_redirect_uri></your_consumer_key><br />
<div id="iframeDivdf2f90c1-5ab5-4817-908e-7e818fa20c53" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframedf2f90c1-5ab5-4817-908e-7e818fa20c53" src="http://www.blogtrog.com/code.aspx?id=df2f90c1-5ab5-4817-908e-7e818fa20c53" style="border: 1px solid #e0e0e0; height: 200px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDivdf2f90c1-5ab5-4817-908e-7e818fa20c53" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: purple;">$mySoapClient</span><span style="color: black;"> </span><span style="color: black;">=</span><span style="color: black;"> </span><span style="color: purple;">$sfConnection</span><span style="color: black;">-></span><span style="color: black;">createConnection(</span><span style="color: black;">'</span><span style="color: black;">partner.wsdl</span><span style="color: black;">'</span><span style="color: black;">);
</span><span style="color: purple;">$serverUrl</span><span style="color: black;"> </span><span style="color: black;">=</span><span style="color: black;"> </span><span style="color: black;">"</span><span style="color: black;">https://ap1.salesforce.com/services/Soap/u/25.0/00D90000000Abcd</span><span style="color: black;">"</span><span style="color: black;">;
</span><span style="color: purple;">$sessionId</span><span style="color: black;"> </span><span style="color: black;">=</span><span style="color: black;"> </span><span style="color: black;">"</span><span style="color: black;"><<ACCESS TOKEN>></span><span style="color: black;">"</span><span style="color: black;">;
</span><span style="color: purple;">$mylogin</span><span style="color: black;"> </span><span style="color: black;">=</span><span style="color: black;"> </span><span style="color: purple;">$sfConnection</span><span style="color: black;">-></span><span style="color: black;">attach(</span><span style="color: purple;">$serverUrl</span><span style="color: black;">,</span><span style="color: black;"> </span><span style="color: purple;">$sessionId</span><span style="color: black;">);</span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('df2f90c1-5ab5-4817-908e-7e818fa20c53');</script>
<br />
<access token="token"><br /><br />7) Now, how to deal with expired token? For that you need to either make a separate method for it, or simply you need enclosed you code in try, catch block and look for INVALID SESSION exception. That exception will come whenever you try to access server contents and your token is expired. So the idea is, whenever that happen , simply catch that exception and use below code to get new access token. In below code, simply replace the different fields with your org info like consumer key, secret and important "REFRESH TOKEN" which we got in step #5.</access><br />
<br />
<div id="iframeDivdb5307c6-fd85-464b-8a1c-dc73c401d617" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframedb5307c6-fd85-464b-8a1c-dc73c401d617" src="http://www.blogtrog.com/code.aspx?id=db5307c6-fd85-464b-8a1c-dc73c401d617" style="border: 1px solid #e0e0e0; height: 400px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDivdb5307c6-fd85-464b-8a1c-dc73c401d617" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: black;"><?</span><span style="color: black;">php
</span><span style="color: blue;">function</span><span style="color: black;"> getNewToken(){
</span><span style="color: blue;">try</span><span style="color: black;">{
</span><span style="color: purple;">$url</span><span style="color: black;"> </span><span style="color: black;">=</span><span style="color: black;"> </span><span style="color: black;">'</span><span style="color: black;">https://login.salesforce.com/services/oauth2/token</span><span style="color: black;">'</span><span style="color: black;">;
</span><span style="color: purple;">$fields</span><span style="color: black;"> </span><span style="color: black;">=</span><span style="color: black;"> </span><span style="color: blue;">array</span><span style="color: black;">(
</span><span style="color: black;">'</span><span style="color: black;">grant_type</span><span style="color: black;">'</span><span style="color: black;"> </span><span style="color: black;">=></span><span style="color: black;"> </span><span style="color: black;">"</span><span style="color: black;">refresh_token</span><span style="color: black;">"</span><span style="color: black;">,</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;">client_id</span><span style="color: black;">'</span><span style="color: black;"> </span><span style="color: black;">=></span><span style="color: black;"> </span><span style="color: black;">"</span><span style="color: black;">xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx</span><span style="color: black;">"</span><span style="color: black;">,</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;">client_secret</span><span style="color: black;">'</span><span style="color: black;"> </span><span style="color: black;">=></span><span style="color: black;"> </span><span style="color: black;">"</span><span style="color: black;">xxxxxxxxxxx</span><span style="color: black;">"</span><span style="color: black;">,</span><span style="color: black;">
</span><span style="color: black;">'</span><span style="color: black;">refresh_token</span><span style="color: black;">'</span><span style="color: black;"> </span><span style="color: black;">=></span><span style="color: black;"> </span><span style="color: black;">"</span><span style="color: black;">xxxxxxxxxxxxxxxxxxxxxxxxxxxx</span><span style="color: black;">"</span><span style="color: black;">
);
</span><span style="color: blue;">foreach</span><span style="color: black;">(</span><span style="color: purple;">$fields</span><span style="color: black;"> </span><span style="color: blue;">as</span><span style="color: black;"> </span><span style="color: purple;">$key</span><span style="color: black;">=></span><span style="color: purple;">$value</span><span style="color: black;">) { </span><span style="color: purple;">$fields_string</span><span style="color: black;"> </span><span style="color: black;">.=</span><span style="color: black;"> </span><span style="color: purple;">$key</span><span style="color: black;">.</span><span style="color: black;">'</span><span style="color: black;">=</span><span style="color: black;">'</span><span style="color: black;">.</span><span style="color: purple;">$value</span><span style="color: black;">.</span><span style="color: black;">'</span><span style="color: black;">&</span><span style="color: black;">'</span><span style="color: black;">; }
</span><span style="color: purple;">$ch</span><span style="color: black;"> </span><span style="color: black;">=</span><span style="color: black;"> curl_init(</span><span style="color: purple;">$url</span><span style="color: black;">);
</span><span style="color: green;">//</span><span style="color: green;">set the url, number of POST vars, POST data</span><span style="color: green;">
</span><span style="color: black;"> curl_setopt(</span><span style="color: purple;">$ch</span><span style="color: black;">,</span><span style="color: black;">CURLOPT_POST</span><span style="color: black;">,</span><span style="color: black;"> </span><span style="color: blue;">true</span><span style="color: black;">);
curl_setopt(</span><span style="color: purple;">$ch</span><span style="color: black;">,</span><span style="color: black;">CURLOPT_POSTFIELDS</span><span style="color: black;">,</span><span style="color: black;"> </span><span style="color: purple;">$fields_string</span><span style="color: black;">);
curl_setopt (</span><span style="color: purple;">$ch</span><span style="color: black;">,</span><span style="color: black;"> CURLOPT_RETURNTRANSFER</span><span style="color: black;">,</span><span style="color: black;"> </span><span style="color: blue;">true</span><span style="color: black;">);
curl_setopt(</span><span style="color: purple;">$ch</span><span style="color: black;">,</span><span style="color: black;"> CURLOPT_SSL_VERIFYPEER</span><span style="color: black;">,</span><span style="color: black;"> </span><span style="color: blue;">false</span><span style="color: black;">);
</span><span style="color: green;">//</span><span style="color: green;">execute post</span><span style="color: green;">
</span><span style="color: black;"> </span><span style="color: purple;">$result</span><span style="color: black;"> </span><span style="color: black;">=</span><span style="color: black;"> curl_exec(</span><span style="color: purple;">$ch</span><span style="color: black;">);
</span><span style="color: green;">//</span><span style="color: green;">close connection</span><span style="color: green;">
</span><span style="color: black;"> curl_close(</span><span style="color: purple;">$ch</span><span style="color: black;">);
</span><span style="color: purple;">$json_a</span><span style="color: black;">=</span><span style="color: black;">json_decode(</span><span style="color: purple;">$result</span><span style="color: black;">,</span><span style="color: blue;">true</span><span style="color: black;">);
</span><span style="color: blue;">return</span><span style="color: black;"> </span><span style="color: purple;">$json_a</span><span style="color: black;">;
}</span><span style="color: blue;">catch</span><span style="color: black;">(</span><span style="color: blue;">Exception</span><span style="color: black;"> </span><span style="color: purple;">$e</span><span style="color: black;">){
</span><span style="color: teal;">var_dump</span><span style="color: black;">(</span><span style="color: purple;">$e</span><span style="color: black;">);
}
}
</span><span style="color: black;">?></span></div>
</pre>
</div>
<script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('db5307c6-fd85-464b-8a1c-dc73c401d617');</script>
<br />
<div id="iframeDivf4de5ee9-3e82-4653-a8c5-0ed1f858173a" style="display: none; margin: 0px;">
<iframe frameborder="0" id="iframef4de5ee9-3e82-4653-a8c5-0ed1f858173a" src="http://www.blogtrog.com/code.aspx?id=f4de5ee9-3e82-4653-a8c5-0ed1f858173a" style="border: 1px solid #e0e0e0; height: 400px; margin: 0px; width: 600px;"></iframe></div>
<div id="noIframeDivf4de5ee9-3e82-4653-a8c5-0ed1f858173a" style="display: block; margin: 0px;">
<pre><div>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
--><span style="color: black;"></span></div>
</pre>
</div>
<access token="token"></access>You can simply call this method getNewToken() to make new token whenever needed.<access token="token"><br /><br />You are now all set, now you don't have to worry about user credentials updation or revealing it.<br /><br />Let me know if you face issue in any step.<br /><br />Thanks<br />Aslam Bari</access></div>
Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com19tag:blogger.com,1999:blog-1716073687404477810.post-90539708736770124662012-07-22T22:11:00.003-07:002012-07-22T22:11:46.744-07:00Easy SF Pagination Tool<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />As most of you must know that Salesforce recently introduced "OFFSET" keyword in SOQL. This feature makes implementation of pagination very easy and effective. Now there is no need to query and store all the records in memory. So it is truly a light weight. So here i have implemented one pagination tool here which is made on "Contact" object. If you want to make it for your custom object, then it is very easy to modify code to work with any object. <br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPwTeCsdeVVq7Fztfg71eYQOW-z_Ild7VQW7fOoZviJlhAeJ-ZmNzhVCwQ98a7EgRNqHYygn-nmlpkjoLBRbXnjazvkMHaNz922DmKlUh-zC8v3pdBxQkdl5u7KxDtN5yjOEIUEcVzbVI/s1600/sf_Pagination.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="272" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjPwTeCsdeVVq7Fztfg71eYQOW-z_Ild7VQW7fOoZviJlhAeJ-ZmNzhVCwQ98a7EgRNqHYygn-nmlpkjoLBRbXnjazvkMHaNz922DmKlUh-zC8v3pdBxQkdl5u7KxDtN5yjOEIUEcVzbVI/s640/sf_Pagination.jpg" width="640" /></a></div>
<br />
<br />
You can see demo here for this implementation. <br /><a href="http://labsprojects-developer-edition.ap1.force.com/sf_Pagination">http://labsprojects-developer-edition.ap1.force.com/sf_Pagination</a><br /><br />Here is the link for download the package.<br /><a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000QEP0">https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000QEP0</a><br /><br />Let me know if you think some kind of enhancement in this. <br />
<br />
Thanks<br />
Aslam Bari</div>Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com5tag:blogger.com,1999:blog-1716073687404477810.post-22972329434139297442012-07-06T00:54:00.000-07:002012-07-09T02:31:31.019-07:00FTP Images in Salesforce Lookup Dialog<div dir="ltr" style="text-align: left;" trbidi="on">
Hi All,<br />
Recently one of my clients needed one product selection lookup dialog with product images in it. The requirements were as below:<br />
<br />
1) Images must not be stored in Salesforce, they want to store images in their own FTP server<br />
2) When user click on create new record, user can select Product from lookup dialog, the same time, in product dialog, user can see the images respective to that particular image. So that it will be easy for user to judge the selection.<br />
<br />
So, here is the solution i came up with.<br />
<br />
1) Store your images in remote FTP server in a folder, for example, i saved my product images at following location:<br />
http://labs.aslambari.com/products/<br />
<br />
2) Give images some unique name similar to ProductCode field of your products like CM_111.jpg, CM_222.jpg, CM_333.jpg etc<br />
<br />
<br />
<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRLfV32fz9GXsj14z07iVZMFRxnd5z2USzJH8wlKJkf-TLXwBrJvAOGT-zhtdliikxIP8WQXYcM9AYi8J5UMxELuy8NPxt9fNHVEI4VGPLM3p-gEk4Fs71M4RORzorg0HrYEwrKBi-g98/s1600/FTP_PRODUCTS.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRLfV32fz9GXsj14z07iVZMFRxnd5z2USzJH8wlKJkf-TLXwBrJvAOGT-zhtdliikxIP8WQXYcM9AYi8J5UMxELuy8NPxt9fNHVEI4VGPLM3p-gEk4Fs71M4RORzorg0HrYEwrKBi-g98/s1600/FTP_PRODUCTS.png" /></a></div>
<br />
<br />
3) Now create one "Product Image" formula (text) field on product object like below:<br />
<br />
<b style="color: #6aa84f;">IMAGE("http://labs.aslambari.com/products/" & ProductCode & ".jpg", ProductCode)</b><br />
<br />
4) Add this field into your product lookup dialog layout (Search layouts)<br />
<br />
5) Now, whenever you will click on any Product lookup field in your org, you will simply see the product image of that particular product code. <br />
<br />
Please check the live demo here.<br />
<a href="http://labsprojects-developer-edition.ap1.force.com/Product_Selection">http://labsprojects-developer-edition.ap1.force.com/Product_Selection</a><br />
<br />
Click on Product lookup field, Select "Product Family" filter , equals to , "Camera" value. You will see all products with images. See below screen shot.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrqeeCaNYy2HzuSnj135zK3Y6YCOJVk7syEXFsKL6BjZsSLy9WzauSCIYL2l1hXfjFSqmjinv4Bq4YE-jeT4novSxWDJJr8V6UiuKiQbAuOHb-XAWNgD-Zxh7zrJDIPZNQVHYVaEZUaQU/s1600/Product_Selection_Lookup.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrqeeCaNYy2HzuSnj135zK3Y6YCOJVk7syEXFsKL6BjZsSLy9WzauSCIYL2l1hXfjFSqmjinv4Bq4YE-jeT4novSxWDJJr8V6UiuKiQbAuOHb-XAWNgD-Zxh7zrJDIPZNQVHYVaEZUaQU/s320/Product_Selection_Lookup.png" width="320" /></a></div>
<br />
<br />
Hope this will help some developers to achieve this kind of requirement sometime.<br />
<br />
Thanks<br />
Aslam Bari</div>Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com11tag:blogger.com,1999:blog-1716073687404477810.post-30813994688607327532012-03-21T07:56:00.005-07:002012-03-21T08:04:24.754-07:00Google Transliteration component for SalesforceHi All,<br /><div style="text-align: justify;">Recently I had a requirement where client needs easy way to type details in both English/Hindi language in Standard Salesforce screens. For example, there are call center agent users. They use Salesforce Case screen to type whatever detail they get from end customer. Client needs that agent can type details or resolution in both English and Hindi language. So, i come up with one solution here. I used "Google Transliteration" JS API to achieve it and attached this to standard description field for Case Edit screen.<br /></div><br /><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsv0a-xdcOtp6qQPdBLFpxHHG4M_rq-4KITgP2POuZoZiLowbeVxfMKdq1KuJBHFvBXLykqwKnMI5y_jO47CLh5sXeE-bgK5rtJjHISuGV2NIcT2Szfpwv3qx0VbF8ugXboOMYE8WfznQ/s1600/Google+Transliteration+Support.jpg"><img style="cursor: pointer; width: 407px; height: 161px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsv0a-xdcOtp6qQPdBLFpxHHG4M_rq-4KITgP2POuZoZiLowbeVxfMKdq1KuJBHFvBXLykqwKnMI5y_jO47CLh5sXeE-bgK5rtJjHISuGV2NIcT2Szfpwv3qx0VbF8ugXboOMYE8WfznQ/s320/Google+Transliteration+Support.jpg" alt="" id="BLOGGER_PHOTO_ID_5722365880940037186" border="0" /></a><br /></div><br />I found this is useful for many others people or developers. So I come up with one common component solution for this. Here is a screen cast you can see this in Action.<br /><br /><a href="http://screencast.com/t/J5OrRMAR">http://screencast.com/t/J5OrRMAR</a><br /><br />How to install:<br /><br />1) Download the "Google Transliteration Support" Home page component code from here <a href="http://labs.aslambari.com/google_transliteration_support.txt">http://labs.aslambari.com/google_transliteration_support.txt</a><br />2) Make one "Narrow Side Bar" html component in your SFDC org and put the code there.<br />3) Enable this component to Active Home page layout (Make sure it will be visible on all pages in sidebar)<br />4) Some settings you need to take care (or need to change)<br /><br />Language: You can see the line of code "google.elements.transliteration.LanguageCode.HINDI". This is the target language. You can change it if you want the native language according to your need.<br /><br /><div style="text-align: justify;">Field Id: You can see the line of code "opp14". This is the field id of "description" field of Opportunity Edit Screen. You can find the any field id (textarea/text) of the object which you want to make transliteration support. And you need to give that id here.<br /></div><br /><div style="text-align: justify;">Extra feature: There is one extra hidden feature here. While you are typing you can toggle between language "Ctrl + g" shortcut keys. But be sure this is not synch with Button on left side (I did not get much time for that, so left that). But this is very convenient for a agent to switch between two language using shortcut keys.<br /></div><br />Let me know your thoughts once you able to use it.<br /><br />Thanks<br />Aslam BariAslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com17tag:blogger.com,1999:blog-1716073687404477810.post-13855447691291387612012-03-13T00:14:00.002-07:002012-03-13T00:17:05.466-07:00TechShare Cloud Forum LaunchedHi All,<br />I am pleased to inform that I have created a very nice and simple forum where you can post your questions regarding Salesforce and other technology.<br /><br /><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYIhwch1rhXKid0R-n4hQNr8nI7uAsmVhnkScC_eFkSptlgcAVkyuPZmSKOZCALCKYpjCr42vVDyjf30sraRbk8dEp_Adlrw-RStNo9n003Xx4cBrhszvtfU4nbjK7B2eV9OQPJG3kQPg/s1600/T681RL3PLY1U.png"><img style="cursor:pointer; cursor:hand;width: 200px; height: 150px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYIhwch1rhXKid0R-n4hQNr8nI7uAsmVhnkScC_eFkSptlgcAVkyuPZmSKOZCALCKYpjCr42vVDyjf30sraRbk8dEp_Adlrw-RStNo9n003Xx4cBrhszvtfU4nbjK7B2eV9OQPJG3kQPg/s320/T681RL3PLY1U.png" alt="" id="BLOGGER_PHOTO_ID_5719276988783674274" border="0" /></a><br /></div><br />Please post your questions there to get answers quickly.<br /><br /><a href="http://forum.aslambari.com">forum.aslambari.com</a><br /><br /><br />Thanks<br />Aslam BariAslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com2tag:blogger.com,1999:blog-1716073687404477810.post-50639790742050167402012-02-14T05:24:00.000-08:002012-02-14T05:28:34.802-08:00Light Weight SF force.com chat plugin for sitesHi All,<br />Here, I am going to introduce the "Light Weight SF force.com chat plugin for sites".<br /><br />This is easy to install and setup in your force.com site and easy to use. The positive thing is that it saves data in your native salesforce object for your review. This is just a demo app, if one want, he can extend this app to make more robust.<br /><br /><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYxRbEjJEFF5-ei1Csv0YGwRwEd8bWrjo18NSZEMbrvlfm1TmL1YWYqp_Jx9ndKoxcNatjMf9gUSivHfWxXkinWMv2ECeLFN96WNftuC4z2Sl8ioqwMM3XmXj_XtvBLjPXcLRl4xW5sUE/s1600/chathome.png"><img style="cursor:pointer; cursor:hand;width: 320px; height: 237px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYxRbEjJEFF5-ei1Csv0YGwRwEd8bWrjo18NSZEMbrvlfm1TmL1YWYqp_Jx9ndKoxcNatjMf9gUSivHfWxXkinWMv2ECeLFN96WNftuC4z2Sl8ioqwMM3XmXj_XtvBLjPXcLRl4xW5sUE/s320/chathome.png" alt="" id="BLOGGER_PHOTO_ID_5708982151890650210" border="0" /></a><br /></div><br />1) You can simply install it from here:<br /><a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Q0Re">https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Q0Re</a><br /><br />2) After deploy, you can simply access the first page by /apex/JoinChat It will ask you to click on join now link, if you already logged in before in chat room, you will be redirect to chathome page<br /><br />3) If you not logged in, you will be redirected to /apex/chatlogin page, here you can give a name for yourself to use in chat room<br /><br />4) To go chat room, you can call this page /apex/chathome Here you can see existing public people who are logged into same chat room To best use , you need to setup all 3 pages on public force.com site.<br /><br />Here is a demo hosted on my site:<br />i)JoinChat<br /><a href="http://labsprojects-developer-edition.ap1.force.com/JoinChat">http://labsprojects-developer-edition.ap1.force.com/JoinChat</a><br /><br />ii) ChatLogin<br /><a href="http://labsprojects-developer-edition.ap1.force.com/chatlogin">http://labsprojects-developer-edition.ap1.force.com/chatlogin</a><br /><br />iii) ChatHome<br /><a href="http://labsprojects-developer-edition.ap1.force.com/chathome">http://labsprojects-developer-edition.ap1.force.com/chathome</a><br /><br />Note: For automatic updates, due to too much request i have set 30 seconds auto update for chat<br /><br />There are chances of more enhancements, but its just a start :)<br /><br />Thanks<br />Aslam BariAslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com1tag:blogger.com,1999:blog-1716073687404477810.post-27290176660757157032011-12-13T20:42:00.000-08:002011-12-13T20:59:19.718-08:00Overlay Effect for VF form submitHi All,
<br /><div style="text-align: justify;">Overlay box is many times used whenever there is a need to show user a processing box and we dont need user do any activity on page while processing is going on. So i am sharing a simple vf component here which has css and js which gives overlay effect in your normal VF pages like below:
<br /></div>
<br /><c:overlay style="processing">
<br />
<br />Here "style" attribute can have two values for now [classic, processing]. Classic style shows gray overlay, and Processing style shows animated image.
<br />
<br /><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn1ZDUAyK7VTDg5TMs_FjIhonc1tPbsaU1-kTLOSoPEp5Z_mOao14QWsZ0PcxzLO2iTh8I84VeoWVdsSFaw7UbFnMQ3qG5XHrgDwKxukvo5lS0XrLYQZ5uJApLxCt-EUyEIO0jwW8kzQI/s1600/busy.gif"><img style="cursor:pointer; cursor:hand;width: 200px; height: 200px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn1ZDUAyK7VTDg5TMs_FjIhonc1tPbsaU1-kTLOSoPEp5Z_mOao14QWsZ0PcxzLO2iTh8I84VeoWVdsSFaw7UbFnMQ3qG5XHrgDwKxukvo5lS0XrLYQZ5uJApLxCt-EUyEIO0jwW8kzQI/s320/busy.gif" alt="" id="BLOGGER_PHOTO_ID_5685841052570796994" border="0" /></a>
<br /></div>
<br />Here is the steps how you can use this component to achieve overlay effect:
<br />
<br />1) put the component in head section of your page
<br /><c:overlay style="classic">
<br />
<br />2) put this div at the very bottom of your page, just before close of </body> tag or </apex:page> tag
<br /><div id="overlay"></div>
<br />
<br />3) put this <apex:actionstatus in your form
<br /><apex:actionstatus id="overlayStatus" onstart="showOverlay();" onstop="hideOverlay();"></apex:actionstatus>
<br />
<br />4) finally refer this action status in your action function or command button as below
<br /><apex:commandbutton action="{!saveRecord}" status="overlayStatus" value="Save" rerender="pBlock">
<br />
<br />Here is the complete code :
<br />
<br />
<br /><div id="iframeDiv082c5149-d08f-424c-acb7-c4eee9512bdb" style="display:none;margin:0px;"><iframe id="iframe082c5149-d08f-424c-acb7-c4eee9512bdb" src="http://www.blogtrog.com/code.aspx?id=082c5149-d08f-424c-acb7-c4eee9512bdb" style="width: 600px; height: 200px; border: 1px solid #e0e0e0;margin:0px;" frameborder="0"></iframe></div><div id="noIframeDiv082c5149-d08f-424c-acb7-c4eee9512bdb" style="display:block;margin:0px;"><pre><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:page </span><span style="color:#FF0000;">controller</span><span style="color:#0000FF;">="OverlayDemoController"</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /></span><span style="color:#0000FF;"><</span><span style="color:#800000;">head</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /></span><span style="color:#0000FF;"><</span><span style="color:#800000;">c:Overlay </span><span style="color:#FF0000;">style</span><span style="color:#0000FF;">="processing"</span><span style="color:#FF0000;"> </span><span style="color:#0000FF;">/></span><span style="color:#000000;">
<br /></span><span style="color:#0000FF;"></</span><span style="color:#800000;">head</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /></span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:form</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:actionStatus </span><span style="color:#FF0000;">id</span><span style="color:#0000FF;">="overlayStatus"</span><span style="color:#FF0000;"> onStart</span><span style="color:#0000FF;">="showOverlay();"</span><span style="color:#FF0000;"> onstop</span><span style="color:#0000FF;">="hideOverlay();"</span><span style="color:#0000FF;">></</span><span style="color:#800000;">apex:actionstatus</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:sectionHeader </span><span style="color:#FF0000;">title</span><span style="color:#0000FF;">="Contact Save"</span><span style="color:#FF0000;"> subtitle</span><span style="color:#0000FF;">="Overlay Demo"</span><span style="color:#FF0000;"> </span><span style="color:#0000FF;">/></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:pageBlock </span><span style="color:#FF0000;">id</span><span style="color:#0000FF;">="pBlock"</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:pageMessages</span><span style="color:#0000FF;">></</span><span style="color:#800000;">apex:pageMessages</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:pageBlockButtons</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:commandButton </span><span style="color:#FF0000;">action</span><span style="color:#0000FF;">="{!saveRecord}"</span><span style="color:#FF0000;"> status</span><span style="color:#0000FF;">="overlayStatus"</span><span style="color:#FF0000;"> value</span><span style="color:#0000FF;">="Save"</span><span style="color:#FF0000;"> reRender</span><span style="color:#0000FF;">="pBlock"</span><span style="color:#0000FF;">/></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"></</span><span style="color:#800000;">apex:pageBlockButtons</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:pageBlockSection</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:inputField </span><span style="color:#FF0000;">value</span><span style="color:#0000FF;">="{!cnt.First_Name__c}"</span><span style="color:#FF0000;"> </span><span style="color:#0000FF;">/></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:inputField </span><span style="color:#FF0000;">value</span><span style="color:#0000FF;">="{!cnt.Last_Name__c}"</span><span style="color:#FF0000;"> </span><span style="color:#0000FF;">/></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:inputField </span><span style="color:#FF0000;">value</span><span style="color:#0000FF;">="{!cnt.Phone__c}"</span><span style="color:#FF0000;"> </span><span style="color:#0000FF;">/></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"><</span><span style="color:#800000;">apex:inputField </span><span style="color:#FF0000;">value</span><span style="color:#0000FF;">="{!cnt.Email__c}"</span><span style="color:#FF0000;"> </span><span style="color:#0000FF;">/></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"></</span><span style="color:#800000;">apex:pageBlockSection</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /> </span><span style="color:#0000FF;"></</span><span style="color:#800000;">apex:pageBlock</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /></span><span style="color:#0000FF;"></</span><span style="color:#800000;">apex:form</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /></span><span style="color:#0000FF;"><</span><span style="color:#800000;">div </span><span style="color:#FF0000;">id</span><span style="color:#0000FF;">="overlay"</span><span style="color:#0000FF;">></</span><span style="color:#800000;">div</span><span style="color:#0000FF;">></span><span style="color:#000000;">
<br /></span><span style="color:#0000FF;"></</span><span style="color:#800000;">apex:page</span><span style="color:#0000FF;">></span></div></pre></div><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('082c5149-d08f-424c-acb7-c4eee9512bdb');</script>
<br />
<br />http://www.blogger.com/img/blank.gif
<br />5) Here are the links for working online demo for the overlay :
<br />
<br /><a href="http://labsprojects-developer-edition.ap1.force.com/OverlayDemo">http://labsprojects-developer-edition.ap1.force.com/OverlayDemo</a>
<br />
<br /><a href="http://labsprojects-developer-edition.ap1.force.com/OverlayDemoProcessing">http://labsprojects-developer-edition.ap1.force.com/OverlayDemoProcessing</a>
<br />
<br />6) You can download the complete code from here:
<br /><a href="http://labs.aslambari.com/overlay.zip">http://labs.aslambari.com/overlay.zip</a>
<br />
<br />Hope it will be useful for developers.
<br />
<br />Thanks
<br />Aslam Bari
<br />
<br /><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('082c5149-d08f-424c-acb7-c4eee9512bdb');</schttp://www.blogger.com/img/blank.gifript><br /><br /><br />5) Here are the links for working online demo for the overlay :<br /><br /><a href="http://labsprojects-developer-edition.ap1.force.com/OverlayDemo">http://labsprojects-developer-edition.ap1.force.com/OverlayDemo</a><br /><br />http://labsprojects-developer-edition.ap1.force.com/OverlayDemoProcessing<br /><br />Hope it will be useful for developers.<br /><br />Thanks<br />Aslam Bari<br />Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com0tag:blogger.com,1999:blog-1716073687404477810.post-55502424472135645182011-10-06T09:22:00.000-07:002011-10-06T10:12:06.793-07:00Stripe Apex ToolkitHi All,<br /><div style="text-align: justify;">Today I came to know about 'Stripe' APIs. <a href="https://stripe.com/">Stripe</a> is a simple, developer-friendly way to accept payments online. According to <a href="https://stripe.com/">Stripe</a> :-<br />"We believe that enabling transactions on the web is a problem rooted in code, not finance, and we want to help put more websites in business.<br />Complexity and opacity have traditionally been hallmarks of online payment processing. We want to fix that."<br /><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7XXV_nHdo_lxJ_hD6RKqJvaKkshB3bD75sVCVTMr23L2PyPDwJfNHhbhiAI5PEwE3C6nZ-tHattM_CzvswAkH7UbXgQZL5gIrC0vzERVTcsCnHo2DoYH48M0cUHp1jWREqWUnAhLhjiQ/s1600/stripe_apex_toolkit.jpg"><img style="cursor: pointer; width: 200px; height: 85px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7XXV_nHdo_lxJ_hD6RKqJvaKkshB3bD75sVCVTMr23L2PyPDwJfNHhbhiAI5PEwE3C6nZ-tHattM_CzvswAkH7UbXgQZL5gIrC0vzERVTcsCnHo2DoYH48M0cUHp1jWREqWUnAhLhjiQ/s320/stripe_apex_toolkit.jpg" alt="" id="BLOGGER_PHOTO_ID_5660417016306694258" border="0" /></a><br /></div><br />So, as usual, here I came up with the solution of Apex Wrapper for Stripe APIs. I developed this API library with my colleague <a href="http://twitter.com/SanjayMankani">Sanjay</a>. The library gives basic api methods to call and use as follows:<br /><br /><div id="iframeDiv2620918e-be18-4b2d-9af5-776b2e3e9781" style="display: none; margin: 0px;"><iframe id="iframe2620918e-be18-4b2d-9af5-776b2e3e9781" src="http://www.blogtrog.com/code.aspx?id=2620918e-be18-4b2d-9af5-776b2e3e9781" style="width: 600px; height: 1000px; border: 1px solid rgb(224, 224, 224); margin: 0px;" frameborder="0"></iframe></div><div id="noIframeDiv2620918e-be18-4b2d-9af5-776b2e3e9781" style="display: block; margin: 0px;"><pre><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">1) CreateCharge</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Stripe request </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Stripe(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">y001LvDyqiGbNZclaaaxxxxttttOJk8w</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />StripeResponseModel response </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.createCharge(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">4242424242424242</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">2013</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">10</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">123</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">2000</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">usd</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">testing</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">response.isError){<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Transaction ID :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.id);<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Transaction Fee :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.fee);<br />}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Error Message :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.errorResponse.message);<br />}<br /><br /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">Create charge using customer</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Stripe request </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Stripe(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">y001LvDyqiGbNZclaaaxxxxttttOJk8w</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />StripeResponseModel response </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.createCharge(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">cus_EPTWuvf7EXDb4g</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">2000</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">usd</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">testing</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">response.isError){<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Transaction ID :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.id);<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Transaction Fee :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.fee);<br />}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Error Message :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.errorResponse.message);<br />}<br /><br /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">2) CreateCustomer</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Stripe request </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Stripe(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">y001LvDyqiGbNZclaaaxxxxttttOJk8w</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />StripeResponseModel response </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.createCustomer(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">4242424242424242</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">10</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">2013</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">123</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Aslam</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">''</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">IN</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">aslam.bari@gmail.com</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">test</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">response.isError){<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Customer ID :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.id);<br />}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Error Message :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.errorResponse.message);<br />}<br /><br /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">3) RetrieveCustomer</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Stripe request </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Stripe(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">y001LvDyqiGbNZclaaaxxxxttttOJk8w</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />StripeResponseModel response </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.retrieveCustomer(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">cus_EPTWuvf7EXDb4g</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">response.isError){<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Customer Country :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.card.country);<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Customer Last4 CC :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.card.last4);<br />}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Error Message :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.errorResponse.message);<br />}<br /><br /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">4) CreateInvoice</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Stripe request </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Stripe(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">y001LvDyqiGbNZclaaaxxxxttttOJk8w</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />StripeResponseModel response </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.createInvoice(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">cus_EPTWuvf7EXDb4g</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">2000</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">usd</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">test</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">response.isError){<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Invoice Id :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.id);<br />}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Error Message :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.errorResponse.message);<br />}<br /><br /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">5) RetrieveInvoice</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Stripe request </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Stripe(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">y001LvDyqiGbNZclaaaxxxxttttOJk8w</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />StripeResponseModel response </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.retreiveInvoice(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">ii_W19Xp6cxrqVABH</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">response.isError){<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Invoice Date :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.created);<br />}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Error Message :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.errorResponse.message);<br />}<br /><br /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">6) CreatePlan</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Stripe request </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Stripe(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">y001LvDyqiGbNZclaaaxxxxttttOJk8w</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />StripeResponseModel response </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.createPlan(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">AMX_101</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">2000</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">usd</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">month</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> , </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">AMX Testing</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">response.isError){<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Plan Id :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.id);<br />}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Error Message :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.errorResponse.message);<br />}<br /><br /></span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">7) RetreivePlan</span><span style="color: rgb(0, 128, 0);"><br /></span><span style="color: rgb(0, 0, 0);">Stripe request </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> Stripe(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">y001LvDyqiGbNZclaaaxxxxttttOJk8w</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />StripeResponseModel response </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> request.retrievePlan(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">AMX_101</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">!</span><span style="color: rgb(0, 0, 0);">response.isError){<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Plan Label :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.name);<br />}</span><span style="color: rgb(0, 0, 255);">else</span><span style="color: rgb(0, 0, 0);">{<br />system.debug(</span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(128, 0, 0);">Error Message :: </span><span style="color: rgb(128, 0, 0);">'</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">+</span><span style="color: rgb(0, 0, 0);"> response.errorResponse.message);<br />}<br /></span></div></pre></div><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('2620918e-be18-4b2d-9af5-776b2e3e9781');</script><br /><br />You can download the code from github here:<br /><a href="https://github.com/aslambari/Stripe-Apex-Toolkit">https://github.com/aslambari/Stripe-Apex-Toolkit</a><br /><br />Or from my website here:<br /><a href="http://www.aslambari.com/stripe_apex_toolkit.html">http://www.aslambari.com/stripe_apex_toolkit.html</a><br /><br />There are many more methods which are under development like CreateSubscription, ListAllCustomers etc, we are working on them. And will back soon with full set of methods. Till, try this library and let us know if that works fine for you and revert back us for enhancements.<br /><br />Thanks<br />Aslam Bari<br /></div>Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com9tag:blogger.com,1999:blog-1716073687404477810.post-58686059988230140952011-10-01T12:03:00.000-07:002011-10-01T12:13:11.384-07:00Showing Salesforce Images/Attachments on PHP/JSP pageHi All,<br /><div style="text-align: justify;">Today I am going to demo you how to fetch images (attachments) from salesforce instance in to your PHP script and how you can show those imags on page as a portal or catalog way.<br /></div><br />1) index.php script<br /><div style="text-align: justify;">The below code shows how you can query to attachment object in salesforce to fetch some attachment records. For example i have query the pics (attachment) for my two SFDC contact records in sample code. The concept is simple. You need to query the Id of attachment in your main page, then you will have one another php script which will fetch the SFDC attachment (image) binary data and show the image on screen as embedded. We can wrap/embed that image in <img /> tag directly.<br /></div><br /><div id="iframeDiv7a41ef2c-3c66-4f16-abb4-68b98e64ddd5" style="display: none; margin: 0px;"><iframe id="iframe7a41ef2c-3c66-4f16-abb4-68b98e64ddd5" src="http://www.blogtrog.com/code.aspx?id=7a41ef2c-3c66-4f16-abb4-68b98e64ddd5" style="width: 600px; height: 200px; border: 1px solid rgb(224, 224, 224); margin: 0px;" frameborder="0"></iframe></div><div id="noIframeDiv7a41ef2c-3c66-4f16-abb4-68b98e64ddd5" style="display: block; margin: 0px;"><pre><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: rgb(0, 0, 0);"><?</span><span style="color: rgb(0, 0, 0);">php<br /></span><span style="color: rgb(0, 128, 128);">error_reporting</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(255, 0, 255);">E_ALL</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">require_once</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">soapclient/SforcePartnerClient.php</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">require_once</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">connection.php</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /><br /></span><span style="color: rgb(128, 0, 128);">$ids</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">array</span><span style="color: rgb(0, 0, 0);">();<br /></span><span style="color: rgb(128, 0, 128);">$ids</span><span style="color: rgb(0, 0, 0);">[] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">00390000006IUVK</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br /></span><span style="color: rgb(128, 0, 128);">$ids</span><span style="color: rgb(0, 0, 0);">[] </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">00390000001lwbd</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">;<br />getPhotos(</span><span style="color: rgb(128, 0, 128);">$ids</span><span style="color: rgb(0, 0, 0);">);<br /><br /><br /></span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> getPhotos(</span><span style="color: rgb(128, 0, 128);">$contactids</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(128, 0, 128);">$mySforceConnection</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> getConnection();<br /> </span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">SELECT Id, Name from Attachment Where ParentId in (</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$contactids</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$id</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">.=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$id</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">',</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> }<br /> </span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 128);">substr</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">,</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 128);">strlen</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">1</span><span style="color: rgb(0, 0, 0);">);<br /> </span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">.=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(128, 0, 128);">$queryResult</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$mySforceConnection</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">query(</span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);">);<br /><br /> </span><span style="color: rgb(128, 0, 128);">$records</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$queryResult</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">records;<br /> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 128, 128);">count</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$records</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);">></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(0, 0, 255);">echo</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><table cellspacing='5' cellpadding='5'><tr></span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(0, 0, 255);">foreach</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$records</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">as</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$rec</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(0, 0, 255);">echo</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><td style='text-align:center;font-size:12px;'></span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><img src='image.php?id=</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 128);">$rec</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">Id</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">' </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">style='width:200px;height:200px;border:1px solid #ccc;padding:10px'/> <br/></span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$rec</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">fields</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">Name</span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);"><br /> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"></td></span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> }<br /> </span><span style="color: rgb(0, 0, 255);">echo</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"></table></span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> }<br /> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">NULL</span><span style="color: rgb(0, 0, 0);">;<br />}<br /></span><span style="color: rgb(0, 0, 0);">?></span></div></pre></div><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('7a41ef2c-3c66-4f16-abb4-68b98e64ddd5');</script><br /><br />2) image.php script<br /><div style="text-align: justify;">This code simply accepts one Id of the attachment record and fetch the binary body of attachment, then it shows that image on the screen as image content. To view this image in other page you simply need to wrap/embed its call into <img /> html tag. Like below:<br /><br /><span style="color: rgb(0, 102, 0);"><img src="image.php?id=00P9000000185ioEAA" /></span><br /><br /></div><br /><div id="iframeDiv834251f7-a0ef-4a8b-811c-5b0b483f9a52" style="display: none; margin: 0px;"><iframe id="iframe834251f7-a0ef-4a8b-811c-5b0b483f9a52" src="http://www.blogtrog.com/code.aspx?id=834251f7-a0ef-4a8b-811c-5b0b483f9a52" style="width: 600px; height: 200px; border: 1px solid rgb(224, 224, 224); margin: 0px;" frameborder="0"></iframe></div><div id="noIframeDiv834251f7-a0ef-4a8b-811c-5b0b483f9a52" style="display: block; margin: 0px;"><pre><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: rgb(0, 0, 0);"><?</span><span style="color: rgb(0, 0, 0);">php<br /></span><span style="color: rgb(0, 128, 128);">error_reporting</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(255, 0, 255);">E_ALL</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 128, 128);">header</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">content-type: image/jpeg</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">require_once</span><span style="color: rgb(0, 0, 0);"> (</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">soapclient/SforcePartnerClient.php</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /></span><span style="color: rgb(0, 0, 255);">require_once</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">connection.php</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br /><br />getPhotos(</span><span style="color: rgb(128, 0, 128);">$_GET</span><span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">id</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">]);<br /><br /><br /></span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> getPhotos(</span><span style="color: rgb(128, 0, 128);">$id</span><span style="color: rgb(0, 0, 0);">){<br /> </span><span style="color: rgb(128, 0, 128);">$mySforceConnection</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> getConnection();<br /> </span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">SELECT Id, Name, Body from Attachment Where Id ='</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(128, 0, 128);">$id</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">.</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">;<br /> </span><span style="color: rgb(128, 0, 128);">$queryResult</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$mySforceConnection</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">query(</span><span style="color: rgb(128, 0, 128);">$query</span><span style="color: rgb(0, 0, 0);">);<br /><br /> </span><span style="color: rgb(128, 0, 128);">$records</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(128, 0, 128);">$queryResult</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">records;<br /><br /> </span><span style="color: rgb(0, 128, 128);">print_r</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 128, 128);">base64_decode</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(128, 0, 128);">$records</span><span style="color: rgb(0, 0, 0);">[</span><span style="color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">]</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">fields</span><span style="color: rgb(0, 0, 0);">-></span><span style="color: rgb(0, 0, 0);">Body));<br /> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">NULL</span><span style="color: rgb(0, 0, 0);">;<br />}<br /><br /></span><span style="color: rgb(0, 0, 0);">?></span></div></pre></div><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('834251f7-a0ef-4a8b-811c-5b0b483f9a52');</script><br /><br /><br />Here is the demo of the scripts where i am fetching two contact's images from Salesforce and showing on simple PHP page.<br /><br /><a href="http://labs.aslambari.com/sfdc_photos_demo/">http://labs.aslambari.com/sfdc_photos_demo/</a><br /><br /><br />Thanks<br />Aslam BariAslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com9tag:blogger.com,1999:blog-1716073687404477810.post-35215029717264389052011-09-13T08:33:00.000-07:002011-09-13T11:12:39.438-07:00SF Uploadify: File Uploading Utility for SalesforceHi All,<br /><div style="text-align: justify;">I have created a very cool file uploading utility which can be integrated with any system, but mainly I focused on Salesforce. This utility is built using Uploadify Tool and PHP integration. You can find more info about <a href="http://www.uploadify.com/">Uploadify</a> <a href="http://www.uploadify.com/">here</a>. It supports multiple file uploading with progress bar and uploads the file to your external server (php server where your site or this utility is hosted.) Then it makes the Attachment record in salesforce and links to actual file on server. So you can directly (natively) access your files.<br /></div><br /><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheFLgWPzjS7B-lGzM0VajH1o4EsGhySHI0cHlldN7lDfQaAGegvge4JpVAEoX_uoTk3JrKJROwB0V1q28rfsb4rwphwDBVEdHbRlRPzAbE3ut0NUJPWfgBp0buM73E75U79iLUtw_Xb5A/s1600/sf_uploadify.gif"><img style="cursor: pointer; width: 320px; height: 68px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEheFLgWPzjS7B-lGzM0VajH1o4EsGhySHI0cHlldN7lDfQaAGegvge4JpVAEoX_uoTk3JrKJROwB0V1q28rfsb4rwphwDBVEdHbRlRPzAbE3ut0NUJPWfgBp0buM73E75U79iLUtw_Xb5A/s320/sf_uploadify.gif" alt="" id="BLOGGER_PHOTO_ID_5651908682743225986" border="0" /></a></div><span style="font-size:130%;"><br /><span style="font-weight: bold;">How it works:</span></span><br /><ol><li>User opens any record in salesforce , lets say "Account" record.</li><li>There will be a custom button (given in below code), user clicks on button</li><li>One file uploading screen opens, click on 'Select Files" button and select multiple files at same time (using control button)</li><li>As soon as, user select and close dialog, it starts uploading files with progress bar</li><li>The files will be stored on the Server where this utility exists, for now it saves to my server.</li><li>It will show finally a screen with close button.</li><li>Click on close button , it will refresh the parent window (if not, manually refresh the parent record)</li><li>Open the attachments section, you will find the new files (attachments created, which actually a link for actual files on the server)</li><li>Click on any file and click on "View" link.</li><li> And you will see it opens your uploaded actual file :)</li></ol><br />More Details and Updates on my site:<br /><a href="http://www.aslambari.com/sf_uploadify.html">http://www.aslambari.com/sf_uploadify.html</a><br /><br /><span style="font-size:130%;"><span style="font-weight: bold;">Installation:</span></span><br />1) <span style="font-weight: bold;">Button code:</span><br />Make one custom button (detail screen button), on any object, for example , account object, see below code.<br />a. Behavior must be "Open in new window"<br />b. Content Source will be "URL"<br />The url for the button will be as below<br /><br /><span style="font-style: italic; color: rgb(0, 102, 0);">http://labs.aslambari.com/sf_file_uploader/sf_setup_uploader.php?sessionid={!$Api.Session_ID}&serverurl={!$Api.Partner_Server_URL_220}&recordid={!Account.Id}</span><br /><br />2) <span style="font-weight: bold;">Utility Code:</span><br />The utility is on my server for now, it is in BETA, once all is tested and working , i will make it public :)<br /><br /><span style="font-style: italic;">Note: For commercial use this tool, you first need to go to </span><a style="font-style: italic;" href="http://www.uploadify.com/">Uploadify</a><span style="font-style: italic;"> site and check its license type if any. Because my tool uses the Uploadify internally.</span><br /><br />See the screen cast how it works:<br /><a href="http://screencast.com/t/ibDqgMBbfQ">http://screencast.com/t/ibDqgMBbfQ</a><br /><br />Hope you will like it. :)<br /><br />Thanks<br />Aslam BariAslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com7tag:blogger.com,1999:blog-1716073687404477810.post-78177497832760491782011-09-10T05:29:00.000-07:002011-09-10T06:01:43.977-07:00Heat Map using Google Map in SalesforceHi All,<br />Recently i came across for one requirement with my client where he wants to see density of his shops across US. For example he has a lot of branches of his coffee shops across US like in CA, TX, MB etc. He want to see a good way on map to see density of his branches. I found the way how to show this, this type of maps are called HeatMaps.<br /><br />Heat Maps are used to show density of your prouduct, services and any useful information on Geaographical area, based on your addresses.<br /><br /><br /><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdG3fRSsb9QqFlpOtDFy6YBRSxsgd0pTykj9GBqOjzA86ho_qZeKGSqGrTu2cA00ra8esaadVb0XzfNT4XZCPIuAZatilm1jzV67OF7ZI2Lm0MJ-WQWtO_Et3clID3qsztzQwpKbwAJpw/s1600/heap-map-google.jpg"><img style="cursor: pointer; width: 320px; height: 281px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdG3fRSsb9QqFlpOtDFy6YBRSxsgd0pTykj9GBqOjzA86ho_qZeKGSqGrTu2cA00ra8esaadVb0XzfNT4XZCPIuAZatilm1jzV67OF7ZI2Lm0MJ-WQWtO_Et3clID3qsztzQwpKbwAJpw/s320/heap-map-google.jpg" alt="" id="BLOGGER_PHOTO_ID_5650709396638104514" border="0" /></a><br /></div><br />The another example may be like, i want to know Starbucks shops across the US and want to know which area has density (number of shops) more.<br />So, i created one example in Salesforce VF page to show, how we can make it.<br /><br />1. Copy paste below code in your VF page<br /><br /><div id="iframeDivc35f7fb2-97fa-4414-aded-9c79d3b3a0ff" style="display: none; margin: 0px;"><iframe id="iframec35f7fb2-97fa-4414-aded-9c79d3b3a0ff" src="http://www.blogtrog.com/code.aspx?id=c35f7fb2-97fa-4414-aded-9c79d3b3a0ff" style="width: 600px; height: 200px; border: 1px solid rgb(224, 224, 224); margin: 0px;" frameborder="0"></iframe></div><div id="noIframeDivc35f7fb2-97fa-4414-aded-9c79d3b3a0ff" style="display: block; margin: 0px;"><pre><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">apex:page </span><span style="color: rgb(255, 0, 0);">showHeader</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(255, 0, 0);"> sidebar</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">src</span><span style="color: rgb(0, 0, 255);">="http://www.heatmapapi.com/javascript/HeatmapAPI.aspx?k=86123b76-2190-4a4b-b182-86e7199b0406"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">src</span><span style="color: rgb(0, 0, 255);">="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA09SA9e7gW5A4Mpy3VCJQjxQfiV3Wc4AiuMkI_RwI0dk2dVyy7hQWusr2PE1VCubWNkTco2njprfSxg"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">src</span><span style="color: rgb(0, 0, 255);">="http://www.heatmapapi.com/javascript/HeatmapAPIGoogle.js"</span><span style="color: rgb(255, 0, 0);"> type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(255, 0, 0);"><br /> src</span><span style="color: rgb(0, 0, 255);">="http://maps.google.com/maps/api/js?sensor=false"</span><span style="color: rgb(0, 0, 255);">></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">script </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="text/javascript"</span><span style="color: rgb(0, 0, 255);">></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> m </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">null</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> batch </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">""</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> myHM </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">null</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> request </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> GXmlHttp.create();<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> TOTAL_COUNT </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">0</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> INDEX </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">0</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> loadGoogle()<br />{<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">if</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> (GBrowserIsCompatible())<br />{<br />m </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> GMap2(document.getElementById(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">map</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">));<br />m.setCenter(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> GLatLng(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">38.5</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">, </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">-</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">95.8</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">), </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">3</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br />m.setUIToDefault();<br />initHeatmap();<br />}<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">else</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />alert(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">'</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">Your Internet browser is not compatible with this website.</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">'</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br />}<br /><br /><br /><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> initHeatmap()<br />{<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"> Heatmap Scripts</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">try</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><br />{<br />myHM </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> GEOHeatmap();<br />myHM.Init(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">400</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">, </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">400</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">); </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"> Must be same as map size, or same ratio</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> addMarkersFromXml();<br /><br /><br /><br /><br /><br />}<br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">catch</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(e)<br />{<br />alert(e);<br />}<br />}<br /><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> addMarkersFromXml(){<br /><br />request.open(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">'</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">GET</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">'</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">, </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">'</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">/apex/data</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">'</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">, </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">true</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br />request.onreadystatechange </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">() {<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">alert(request.readyState);</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">if</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(request.readyState </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">==</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">4</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">) {<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> xmlDoc </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> request.responseXML;<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> markers </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> xmlDoc.documentElement.getElementsByTagName(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">store</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br /> TOTAL_COUNT </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> markers.length;<br /> INDEX </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">0</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">for</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> i</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">0</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">; i </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"><</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> markers.length; i</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">++</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">){<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> state </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> markers[i].getAttribute(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">state</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> density </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">1</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">markers[i].getAttribute("density");</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> geocoder </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> GClientGeocoder();<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> address </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> state;<br /> geocoder.getLatLng(address,<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(point) {<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">if</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> (</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">!</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">point) {<br /> <br /> } </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">else</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> {<br /> fullVal </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> point.lat().toFixed(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">5</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">) </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">+</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">,</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">+</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> point.lng().toFixed(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">5</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">) </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">+</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">,</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">+</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> density </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">+</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">,</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br /> batch </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">+=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> fullVal;<br /> INDEX</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">++</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">;<br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">if</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">(INDEX </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">>=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> TOTAL_COUNT){<br /> startMap();<br /> }<br /> }<br /> });<br /> }<br /> <br /> }<br />}<br /><br /><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">function</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> startMap(){<br /> document.getElementById(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">HMMapdata</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">"</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">).value</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">batch;<br /> myHM.SetData(batch);<br /> myHM.SetBoost(.</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">5</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">); </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"> Optional, see documentation</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> myHM.SetDecay(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">0</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">); </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"> Optional, see documentation</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">var proxyURL = "http://localhost/proxy.php";</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">myHM.SetProxyURL(proxyURL);</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> preUrl </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> myHM.GetURL();<br /><br /> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);">//</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"> Now render in our Google Map</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 128, 0);"><br /></span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">var</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> heatmapOverlay </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">=</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> </span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">new</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);"> HMGoogleOverlay(preUrl);<br /> m.addOverlay(heatmapOverlay);<br />}<br />request.send(</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 255);">null</span><span style="background-color: rgb(245, 245, 245); color: rgb(0, 0, 0);">);<br /><br />}<br /><br /><br /><br /><br /><br /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">script</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">apex:sectionHeader </span><span style="color: rgb(255, 0, 0);">subtitle</span><span style="color: rgb(0, 0, 255);">="Heat Map using Google Map"</span><span style="color: rgb(255, 0, 0);"> title</span><span style="color: rgb(0, 0, 255);">="Aslam Bari (http://www.aslambari.com)"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">body </span><span style="color: rgb(255, 0, 0);">onload</span><span style="color: rgb(0, 0, 255);">="loadGoogle();"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">input </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="hidden"</span><span style="color: rgb(255, 0, 0);"> id</span><span style="color: rgb(0, 0, 255);">="HMMapdata"</span><span style="color: rgb(255, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">input </span><span style="color: rgb(255, 0, 0);">type</span><span style="color: rgb(0, 0, 255);">="hidden"</span><span style="color: rgb(255, 0, 0);"> id</span><span style="color: rgb(0, 0, 255);">="HMImageURL"</span><span style="color: rgb(255, 0, 0);"> name</span><span style="color: rgb(0, 0, 255);">="HMImageURL"</span><span style="color: rgb(0, 0, 255);">/></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">div </span><span style="color: rgb(255, 0, 0);">id</span><span style="color: rgb(0, 0, 255);">="map"</span><span style="color: rgb(255, 0, 0);"> style</span><span style="color: rgb(0, 0, 255);">="width:400px;height:400px;"</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">div</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">body</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">apex:page</span><span style="color: rgb(0, 0, 255);">></span></div></pre></div><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('c35f7fb2-97fa-4414-aded-9c79d3b3a0ff');</script><br /><br /><br />2. Create another page called "data" and copy paste below code in that. Note: this page contains the addresses of your shops, offices etc which we want to see as density. So, change accordingly<br /><br /><div id="iframeDiv99736f04-682d-4035-9b4a-7e67bb343b5e" style="display: none; margin: 0px;"><iframe id="iframe99736f04-682d-4035-9b4a-7e67bb343b5e" src="http://www.blogtrog.com/code.aspx?id=99736f04-682d-4035-9b4a-7e67bb343b5e" style="width: 600px; height: 200px; border: 1px solid rgb(224, 224, 224); margin: 0px;" frameborder="0"></iframe></div><div id="noIframeDiv99736f04-682d-4035-9b4a-7e67bb343b5e" style="display: block; margin: 0px;"><pre><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">apex:page </span><span style="color: rgb(255, 0, 0);">sidebar</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(255, 0, 0);"> showHeader</span><span style="color: rgb(0, 0, 255);">="false"</span><span style="color: rgb(255, 0, 0);"> contentType</span><span style="color: rgb(0, 0, 255);">="text/xml"</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">stores</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">store </span><span style="color: rgb(255, 0, 0);">state</span><span style="color: rgb(0, 0, 255);">="IN,US"</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">store</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">store </span><span style="color: rgb(255, 0, 0);">state</span><span style="color: rgb(0, 0, 255);">="KY,US"</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">store</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">store </span><span style="color: rgb(255, 0, 0);">state</span><span style="color: rgb(0, 0, 255);">="WA,US"</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">store</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"><</span><span style="color: rgb(128, 0, 0);">store </span><span style="color: rgb(255, 0, 0);">state</span><span style="color: rgb(0, 0, 255);">="MB,US"</span><span style="color: rgb(0, 0, 255);">></</span><span style="color: rgb(128, 0, 0);">store</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">stores</span><span style="color: rgb(0, 0, 255);">></span><span style="color: rgb(0, 0, 0);"><br /></span><span style="color: rgb(0, 0, 255);"></</span><span style="color: rgb(128, 0, 0);">apex:page</span><span style="color: rgb(0, 0, 255);">></span></div></pre></div><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('99736f04-682d-4035-9b4a-7e67bb343b5e');</script><br /><br />Note: you need to go http://www.heatmapapi.com to get new Free API key and also for google free api key to get your code work.<br /><br />Here is the working example of this. Click to see.<br /><a href="http://labsprojects-developer-edition.ap1.force.com/HeatMapExample">http://labsprojects-developer-edition.ap1.force.com/HeatMapExample</a><br /><br />Hope you will need this sometime in your project.<br /><br />Thanks<br />Aslam BariAslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com6tag:blogger.com,1999:blog-1716073687404477810.post-55711928946815643502011-09-03T17:41:00.000-07:002011-09-03T17:54:44.322-07:00Make Firefox wise to remember Salesforce CredentialsHi All,
<br />I am back after a long break :). Today i want to share a good trick which help me to save my time in many ways. Thanks to my friend (Abdul Vahid) who given me hint for that.
<br />
<br /><span style="font-size:130%;"><span style="font-weight: bold;">Problem:</span></span>
<br /><div style="text-align: justify;">Most of you (developers) are aware that these days salesforce has disabled the remember password functionality. It does not save or prompt to save any password when you login to the org. It is very hectic to maintain some external doc or sheet for passowrd , for a developer who work and develop in many orgs. For example i work in 20 orgs (sandbox, production) some times. I maintain a separate doc to look and find password whenever i need to work in a org. That takes time and sometimes not easy.
<br /></div>
<br /><span style="font-size:130%;"><span style="font-weight: bold;">Solution:</span></span>
<br />So here is the solution trick :)
<br /><ul><li>Find out where you installed your firefox and go to Components folder. My location is like this "D:\Mozilla Firefox\components".</li><li>Find the "nsLoginManager.js" file and open this in any editor. Before doing this you need to close all instances of firefox.</li><li>Find out following line of code and comment it. I found it near line #805.</li></ul>
<br /><span style="font-weight: bold; font-style: italic;">Before comment</span>
<br /><div id="iframeDiv1cc928c2-13f8-4cd7-bd57-0522ee9eeb0a" style="display: none; margin: 0px;"><iframe id="iframe1cc928c2-13f8-4cd7-bd57-0522ee9eeb0a" src="http://www.blogtrog.com/code.aspx?id=1cc928c2-13f8-4cd7-bd57-0522ee9eeb0a" style="width: 600px; height: 200px; border: 1px solid rgb(224, 224, 224); margin: 0px;" frameborder="0"></iframe></div><div id="noIframeDiv1cc928c2-13f8-4cd7-bd57-0522ee9eeb0a" style="display: block; margin: 0px;"><pre><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: rgb(0, 0, 0);">_isAutocompleteDisabled : </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> (element) {
<br /> </span><span style="color: rgb(0, 0, 255);">if</span><span style="color: rgb(0, 0, 0);"> (element </span><span style="color: rgb(0, 0, 0);">&&</span><span style="color: rgb(0, 0, 0);"> element.hasAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">autocomplete</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">) </span><span style="color: rgb(0, 0, 0);">&&</span><span style="color: rgb(0, 0, 0);">
<br /> element.getAttribute(</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">autocomplete</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">).toLowerCase() </span><span style="color: rgb(0, 0, 0);">==</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">off</span><span style="color: rgb(0, 0, 0);">"</span><span style="color: rgb(0, 0, 0);">)
<br /> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">true</span><span style="color: rgb(0, 0, 0);">;
<br />
<br /> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">;
<br /> },</span></div></pre></div><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('1cc928c2-13f8-4cd7-bd57-0522ee9eeb0a');</script>
<br />
<br />
<br />
<br /><span style="font-weight: bold; font-style: italic;">After comment</span>
<br /><div id="iframeDiv9af4ba0f-95b0-4f14-9489-40afb887f862" style="display: none; margin: 0px;"><iframe id="iframe9af4ba0f-95b0-4f14-9489-40afb887f862" src="http://www.blogtrog.com/code.aspx?id=9af4ba0f-95b0-4f14-9489-40afb887f862" style="width: 600px; height: 200px; border: 1px solid rgb(224, 224, 224); margin: 0px;" frameborder="0"></iframe></div><div id="noIframeDiv9af4ba0f-95b0-4f14-9489-40afb887f862" style="display: block; margin: 0px;"><pre><div><!--
<br />
<br />Code highlighting produced by Actipro CodeHighlighter (freeware)
<br />http://www.CodeHighlighter.com/
<br />
<br />--><span style="color: rgb(0, 0, 0);">_isAutocompleteDisabled : </span><span style="color: rgb(0, 0, 255);">function</span><span style="color: rgb(0, 0, 0);"> (element) {
<br /> </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">if (element && element.hasAttribute("autocomplete") &&</span><span style="color: rgb(0, 128, 0);">
<br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);"> element.getAttribute("autocomplete").toLowerCase() == "off")</span><span style="color: rgb(0, 128, 0);">
<br /></span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(0, 128, 0);">return true;</span><span style="color: rgb(0, 128, 0);">
<br /></span><span style="color: rgb(0, 0, 0);">
<br /> </span><span style="color: rgb(0, 0, 255);">return</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">false</span><span style="color: rgb(0, 0, 0);">;
<br /> },</span></div></pre></div><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('9af4ba0f-95b0-4f14-9489-40afb887f862');</script>
<br />
<br />
<br />Save the file and start your firefox again.
<br />
<br /><span style="font-style: italic;">(Note: The above steps given for Firefox 3.6 version. In other version it may differ)</span>
<br />
<br />Now see, whenever you try to login with username/pwd. Firefox will ask (prompt) you about "remember" password feature. Once you click on "Remember". It will save your username/password for your org. Next time when ever you try to login using your username, it will auto fill password like old days :)
<br />
<br />Now, i do not need to maintain any external password doc. Isn't it cool :)
<br />
<br />
<br />Thanks
<br />Aslam Bari
<br />Aslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com9tag:blogger.com,1999:blog-1716073687404477810.post-33115563430929266952011-07-16T22:26:00.000-07:002011-07-17T03:02:16.637-07:00Apex Toolkit for SalesforceHi All,<br />Its a long time since I last posted :). So i am back with something interesting and useful contents again.<br /><div style="text-align: justify;">Most of us known that whenever we want to connect with any salesforce org and do query the data with any langugae, salesforce gives us some toolkit like PHP toolkit, Java toolkit, Ruby Toolkit, Flex Toolkit etc. But what when we want to connect with a remote Salesforce instance within salesforce only, using native Apex language. People use many alternate to achieve it, some uses partner wsdl to generate apex or some uses javascript toolkit. But I find them not easy to use and not easy to setup and they did not fit in my need.<br /></div>So I come up with my own Apex Toolkit for Salesforce :)<br /><br /><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQtWZy2QNEkCs0XsyPuIVft4qyrpKxNiYJC_06qhF-gEpbbySU5Q1d1uk6GJsM6WWoLZkLWZheU2GiMMMG2f-MrtmHKJrf_VER0c-jYYpnPSng9MbJF9DWMu0269W5WJ0pN76yxE3aEGI/s1600/ApexToolkitFotSalesforce.jpg"><img style="cursor: pointer; width: 160px; height: 121px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhQtWZy2QNEkCs0XsyPuIVft4qyrpKxNiYJC_06qhF-gEpbbySU5Q1d1uk6GJsM6WWoLZkLWZheU2GiMMMG2f-MrtmHKJrf_VER0c-jYYpnPSng9MbJF9DWMu0269W5WJ0pN76yxE3aEGI/s320/ApexToolkitFotSalesforce.jpg" alt="" id="BLOGGER_PHOTO_ID_5630188743713292722" border="0" /></a><br /></div><br /><br />Its easy to install package. You can install it from here:<br /><a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Priq"></a><a href="https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Priq">https://login.salesforce.com/packaging/installPackage.apexp?p0=04t90000000Priq</a><br /><br />For successful connectivity to any remote instance one entry for that salesforce server TYPE must be there in your remote site setting. I have by default included in package (NA1 to NA7) server url for salesforce. You can add more like (CS1 - CS9, NA1 - NA11, AP1 - AP10). For example see the below screen shot how i added most likely used server instances in my remote site settings. There must be 20-25 possible entries at most in my opinion.<br /><br /><div style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwoFlIFoIxBOZ0cRCqpNhWQKvl8dj0_KTHYa7hSdC4IwqvzCO0gxit6blOuz3n6x5pCudVP9OL3KU6PDE4SXHOkHkWpiTs5MJPTpNBBEu-BtPbYoqtWjOimqLj6YiiqP0MOt7CvvhhjIw/s1600/remotesite.jpg"><img style="cursor: pointer; width: 320px; height: 261px;" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhwoFlIFoIxBOZ0cRCqpNhWQKvl8dj0_KTHYa7hSdC4IwqvzCO0gxit6blOuz3n6x5pCudVP9OL3KU6PDE4SXHOkHkWpiTs5MJPTpNBBEu-BtPbYoqtWjOimqLj6YiiqP0MOt7CvvhhjIw/s320/remotesite.jpg" alt="" id="BLOGGER_PHOTO_ID_5630197117978719746" border="0" /></a><br /></div><br />It is very easy to use with only simple some lines of code to login and do a query to remote instance as below:<br /><br /><div id="iframeDiv34fd7e8f-42fb-4a55-86c3-68b4e4f868c3" style="display: none; margin: 0px;"><iframe id="iframe34fd7e8f-42fb-4a55-86c3-68b4e4f868c3" src="http://www.blogtrog.com/code.aspx?id=34fd7e8f-42fb-4a55-86c3-68b4e4f868c3" style="width: 600px; height: 200px; border: 1px solid rgb(224, 224, 224); margin: 0px;" frameborder="0"></iframe></div><div id="noIframeDiv34fd7e8f-42fb-4a55-86c3-68b4e4f868c3" style="display: block; margin: 0px;"><pre><div><!-- Code highlighting produced by Actipro CodeHighlighter (freeware) http://www.CodeHighlighter.com/ --><span style="color: rgb(0, 0, 0);">SFConnectionController controller </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> </span><span style="color: rgb(0, 0, 255);">new</span><span style="color: rgb(0, 0, 0);"> SFConnectionController();<br />LoginResult loginResult </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> controller.login(username, password, securityToken);<br />Response response </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> controller.query(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">select Name, Email, Phone, MailingCity, MailingCountry from Contact</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">, loginResult);<br /></span><span style="color: rgb(0, 0, 255);">for</span><span style="color: rgb(0, 0, 0);">(Record row: response.data.records){<br />string Name </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> row.getFieldValue(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">Name</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />string Email </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> row.getFieldValue(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">Email</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />string Phone </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> row.getFieldValue(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">Phone</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />string MailingCity </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> row.getFieldValue(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">MailingCity</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />string MailingCountry </span><span style="color: rgb(0, 0, 0);">=</span><span style="color: rgb(0, 0, 0);"> row.getFieldValue(</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">MailingCountry</span><span style="color: rgb(0, 0, 0);">'</span><span style="color: rgb(0, 0, 0);">);<br />}</span></div></pre></div><script language="javascript" src="http://www.blogtrog.com/scripts/bt_code.js" type="text/javascript"></script><script language="javascript" type="text/javascript">bt_code_init('34fd7e8f-42fb-4a55-86c3-68b4e4f868c3');</script><br /><br />There is one demo page and controller in package which shows how to use this functionality.<br /><span style="font-weight: bold;">SFConnectionDemo</span><br /><span style="font-weight: bold;">SFConnectionDemoController</span><br /><br />The toolkit is just a start and gives users facility to do login and do simple queries on objects. One can easily extend this for better version. If you want to contribute in this, i have shared this project as open source here:<br /><br /><a href="http://code.google.com/p/apex-toolkit-for-salesforce/">http://code.google.com/p/apex-toolkit-for-salesforce/</a><br /><br />Here is one running online demo which shows how this package works. Just give your developer/production org's username, password (or securityToken as well), and click on search button. It will fetch the contact records from your organization and will display in table below.<br /><br /><a href="http://labsprojects-developer-edition.ap1.force.com/SFConnectionDemo">http://labsprojects-developer-edition.ap1.force.com/SFConnectionDemo</a><br /><br />Hope you will like it :)<br />Mail me for any configuration or setup issues and for feedback.<br /><br />Thanks<br />Aslam BariAslam - The Alexendrahttp://www.blogger.com/profile/09450719086908671499noreply@blogger.com15