<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9045857152608287021</id><updated>2024-08-30T07:18:30.646-04:00</updated><title type='text'>Salesforce Inside Out</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://forceio.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://forceio.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Vahid Fotovat</name><uri>http://www.blogger.com/profile/08311933467452089240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5qYi7GGKaT_zN96ZuZvgM2uLJl_hYvELXH3XkMvkyImBHOHRlCQz4EmELa8PqC-iEOqwBuKpsEiCaJkdBpiZUd34UiBlWgBPNzcBqiCaLal1-K1-165tgpFX08BK3Pwk/s220/IMG_2072.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9045857152608287021.post-4112442039164632138</id><published>2012-08-14T17:30:00.000-04:00</published><updated>2012-08-14T17:30:00.370-04:00</updated><title type='text'>Large Collection of Microsoft eBooks</title><content type='html'>I came across Eric &lt;a href=&quot;http://blogs.msdn.com/b/mssmallbiz/&quot;&gt;Ligman Blog&lt;/a&gt; where in one of his blogs he has shared a large collection of &lt;a href=&quot;http://blogs.msdn.com/b/mssmallbiz/archive/2012/07/27/large-collection-of-free-microsoft-ebooks-for-you-including-sharepoint-visual-studio-windows-phone-windows-8-office-365-office-2010-sql-server-2012-azure-and-more.aspx&quot;&gt;Microsoft eBook&lt;/a&gt;.  In his blog, he has also shared a &lt;a href=&quot;http://blogs.msdn.com/b/mssmallbiz/archive/2012/07/30/another-large-collection-of-free-microsoft-ebooks-and-resource-kits-for-you-including-sharepoint-2013-office-2013-office-365-duet-2-0-azure-cloud-windows-phone-lync-dynamics-crm-and-more.aspx?wa=wsignin1.0&quot;&gt;second link&lt;/a&gt; to even more books!

Thank you for sharing.

Happy Reading

</content><link rel='replies' type='application/atom+xml' href='http://forceio.blogspot.com/feeds/4112442039164632138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://forceio.blogspot.com/2012/08/large-collection-of-microsoft-ebooks.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/4112442039164632138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/4112442039164632138'/><link rel='alternate' type='text/html' href='http://forceio.blogspot.com/2012/08/large-collection-of-microsoft-ebooks.html' title='Large Collection of Microsoft eBooks'/><author><name>Vahid Fotovat</name><uri>http://www.blogger.com/profile/08311933467452089240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5qYi7GGKaT_zN96ZuZvgM2uLJl_hYvELXH3XkMvkyImBHOHRlCQz4EmELa8PqC-iEOqwBuKpsEiCaJkdBpiZUd34UiBlWgBPNzcBqiCaLal1-K1-165tgpFX08BK3Pwk/s220/IMG_2072.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9045857152608287021.post-6493532201639226385</id><published>2012-07-03T20:42:00.001-04:00</published><updated>2012-12-12T07:53:10.136-05:00</updated><title type='text'>Convert 15 Digit Salesforce ID to 18 Digit</title><content type='html'>There are many articles on the internet that provides you with formulas on how to convert a 15 digit Salesforce ID to 18 digit.  However when I was looking for online  tool to actually do this conversion, I couldn&#39;t find one.  So I created my own tool that allows me to do just that.  If anyone else is interested in using this tool I&#39;ve made it available at:

&lt;a href=&quot;http://www.magentrix.com/aspx/ConvertSFID&quot;&gt;
http://www.magentrix.com/aspx/ConvertSFID&lt;/a&gt;

Happy Converting</content><link rel='replies' type='application/atom+xml' href='http://forceio.blogspot.com/feeds/6493532201639226385/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://forceio.blogspot.com/2012/07/convert-15-digit-salesforce-id-to-18.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/6493532201639226385'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/6493532201639226385'/><link rel='alternate' type='text/html' href='http://forceio.blogspot.com/2012/07/convert-15-digit-salesforce-id-to-18.html' title='Convert 15 Digit Salesforce ID to 18 Digit'/><author><name>Vahid Fotovat</name><uri>http://www.blogger.com/profile/08311933467452089240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5qYi7GGKaT_zN96ZuZvgM2uLJl_hYvELXH3XkMvkyImBHOHRlCQz4EmELa8PqC-iEOqwBuKpsEiCaJkdBpiZUd34UiBlWgBPNzcBqiCaLal1-K1-165tgpFX08BK3Pwk/s220/IMG_2072.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9045857152608287021.post-4464723149639900279</id><published>2012-05-25T07:25:00.001-04:00</published><updated>2012-05-25T07:29:28.755-04:00</updated><title type='text'>Converting C# DateTime to Salesforce.com DateTime</title><content type='html'>One of the most common tasks I need to do when dealing with Salesforce.com Partner or Enterprise WSDL is that I need to convert Microsoft DotNet Framework date &amp;amp; time to format that it is understood by Salesforce.com; whether it be using it in a query or using it with Partner API to create a record that has a date &amp;amp; time field.&amp;nbsp; To make my own life easier, I&#39;ve created a very simple one liner method to do this job for me:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, &quot;Courier New&quot;, Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #a31515; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;div class=&quot;csharpcode&quot;&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; ConvertToForceDateTime(DateTime dateTime)&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Utc);&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; dateTime.ToString(&lt;span class=&quot;str&quot;&gt;&quot;yyyy-MM-ddTHH:mm:ssZ&quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
I find that sometime creating simple one liner methods can make life so much easier.&lt;br /&gt;
&lt;br /&gt;
Happy Coding</content><link rel='replies' type='application/atom+xml' href='http://forceio.blogspot.com/feeds/4464723149639900279/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://forceio.blogspot.com/2012/05/converting-c-datetime-to-salesforcecom.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/4464723149639900279'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/4464723149639900279'/><link rel='alternate' type='text/html' href='http://forceio.blogspot.com/2012/05/converting-c-datetime-to-salesforcecom.html' title='Converting C# DateTime to Salesforce.com DateTime'/><author><name>Vahid Fotovat</name><uri>http://www.blogger.com/profile/08311933467452089240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5qYi7GGKaT_zN96ZuZvgM2uLJl_hYvELXH3XkMvkyImBHOHRlCQz4EmELa8PqC-iEOqwBuKpsEiCaJkdBpiZUd34UiBlWgBPNzcBqiCaLal1-K1-165tgpFX08BK3Pwk/s220/IMG_2072.JPG'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9045857152608287021.post-8143367596904164131</id><published>2012-05-20T19:41:00.002-04:00</published><updated>2012-05-20T19:43:07.474-04:00</updated><title type='text'>How to Query all the fields in your Salesforce Object using Partner WSDL</title><content type='html'>In my previous blog I showed you how you can query any object in Salesforce without having to write all the fields in the object using the Enterprise WSDL.&amp;nbsp; In this post, I&#39;m going to re-write the same method using the Partner WSDL.&amp;nbsp; The method signature will be a little different using the Partner WSDL, the most noticeable one will be that I will not be able to make use of Generic like I did with Enterprise WSDL.&lt;br /&gt;
&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, &quot;Courier New&quot;, Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #a31515; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;br /&gt;
&lt;div class=&quot;csharpcode&quot; style=&quot;overflow-y: hidden; overflow: auto;&quot;&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;static&lt;/span&gt; IEnumerable&amp;lt;sObject&amp;gt; QueryObject(&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; sObjectName, SforceService binding)&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    List&amp;lt;sObject&amp;gt; result = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; List&amp;lt;sObject&amp;gt;();&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    &lt;span class=&quot;rem&quot;&gt;// Get more information about the object&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    DescribeSObjectResult describeResult = binding.describeSObject(sObjectName);&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (describeResult.queryable)&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;        &lt;span class=&quot;rem&quot;&gt;// Get all the sObject&#39;s fields in an array&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;        IEnumerable&amp;lt;&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;&amp;gt; fields = describeResult.fields.Select(a =&amp;gt; a.name);&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; query = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Format(&lt;span class=&quot;str&quot;&gt;&quot;SELECT {0} FROM {1}&quot;&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Join(&lt;span class=&quot;str&quot;&gt;&quot;, &quot;&lt;/span&gt;, fields), sObjectName);&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (binding != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;            &lt;span class=&quot;rem&quot;&gt;// Send the query to Salesforce&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;            QueryResult qResult = binding.query(query);&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;            &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (qResult.records != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp; qResult.records.Length &amp;gt; 0)&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;                result.AddRange(qResult.records);&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;            &lt;span class=&quot;rem&quot;&gt;// Keep querying until we have all the records&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;            while (!qResult.done &amp;amp;&amp;amp; !&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.IsNullOrEmpty(qResult.queryLocator))&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;            {&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;                qResult = binding.queryMore(qResult.queryLocator);&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (qResult.records != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp; qResult.records.Length &amp;gt; 0)&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;                    result.AddRange(qResult.records);&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;            }&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; result;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Although this make querying Salesforce objects very easy, there is one big drawback; that is the describeSObject will count toward an API calls.&amp;nbsp; This means that every query to Salesforce will have one additional API call.&amp;nbsp; My suggestion is if you are making too many query calls, try to cache the objects fields.&amp;nbsp; This will result in less API call and faster execution since there is one less trip to Salesforce.&lt;br /&gt;
&lt;br /&gt;
Also same &lt;span style=&quot;font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11pt; line-height: 115%;&quot;&gt;restrictions
&lt;/span&gt;to the query length apply here too.&amp;nbsp; Make sure you stay within the 10K characters when building your query string.&lt;br /&gt;
&lt;br /&gt;
Happy Coding</content><link rel='replies' type='application/atom+xml' href='http://forceio.blogspot.com/feeds/8143367596904164131/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://forceio.blogspot.com/2012/05/how-to-query-all-fields-in-your_20.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/8143367596904164131'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/8143367596904164131'/><link rel='alternate' type='text/html' href='http://forceio.blogspot.com/2012/05/how-to-query-all-fields-in-your_20.html' title='How to Query all the fields in your Salesforce Object using Partner WSDL'/><author><name>Vahid Fotovat</name><uri>http://www.blogger.com/profile/08311933467452089240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5qYi7GGKaT_zN96ZuZvgM2uLJl_hYvELXH3XkMvkyImBHOHRlCQz4EmELa8PqC-iEOqwBuKpsEiCaJkdBpiZUd34UiBlWgBPNzcBqiCaLal1-K1-165tgpFX08BK3Pwk/s220/IMG_2072.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9045857152608287021.post-7119864866458975714</id><published>2012-05-18T18:44:00.000-04:00</published><updated>2012-05-18T18:47:23.129-04:00</updated><title type='text'>How to Query all the fields in your Salesforce Object using Enterprise WSDL</title><content type='html'>&lt;br /&gt;
Welcome to ForceIO blog.&amp;nbsp; I’m hoping that this will be the first of many blogs to come.&amp;nbsp; In my blogs I will try to focus on development of Salesforce.com solutions using Microsoft .NET (C#).&amp;nbsp; I may deviate from time to time, but I will try to mostly keep it relevant.&lt;br /&gt;
&lt;br /&gt;
Did you ever wish that you could just query all your Salesforce Object fields without writing the name of all the fields in the query one by one?&amp;nbsp; SQL give you ability to query all the fields as such:&lt;br /&gt;
&lt;br /&gt;
SELECT * FROM EntityName&lt;br /&gt;
&lt;br /&gt;
But this is simply not possible when querying Salesforce Objects.&amp;nbsp; To get around this minor setback, I’ve created a utility method that queries any force object with all its fields. &lt;br /&gt;
&lt;br /&gt;
&lt;style type=&quot;text/css&quot;&gt;
.csharpcode, .csharpcode pre
{
 font-size: small;
 color: black;
 font-family: Consolas, &quot;Courier New&quot;, Courier, Monospace;
 background-color: #ffffff;
 /*white-space: pre;*/
}

.csharpcode pre { margin: 0em; }

.csharpcode .rem { color: #008000; }

.csharpcode .kwrd { color: #0000ff; }

.csharpcode .str { color: #a31515; }

.csharpcode .op { color: #0000c0; }

.csharpcode .preproc { color: #cc6633; }

.csharpcode .asp { background-color: #ffff00; }

.csharpcode .html { color: #800000; }

.csharpcode .attr { color: #ff0000; }

.csharpcode .alt 
{
 background-color: #f4f4f4;
 width: 100%;
 margin: 0em;
}

.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;br /&gt;
&lt;div class=&quot;csharpcode&quot; style=&quot;overflow-y: hidden; overflow: auto;&quot;&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;static&lt;/span&gt; IEnumerable&amp;lt;T&amp;gt; QueryObject&amp;lt;T&amp;gt;(SforceService binding) where T : sObject&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   2:  &lt;/span&gt;{&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   3:  &lt;/span&gt;    List&amp;lt;T&amp;gt; result = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; List&amp;lt;T&amp;gt;();&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   4:  &lt;/span&gt;    Type sObjectType = &lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(T);&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   5:  &lt;/span&gt;    IEnumerable&amp;lt;&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;&amp;gt; sObjectProperties = sObjectType.GetProperties().Where(a =&amp;gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   6:  &lt;/span&gt;        &lt;span class=&quot;rem&quot;&gt;/* Property must be accessible */&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   7:  &lt;/span&gt;        a.CanRead &amp;amp;&amp;amp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;   8:  &lt;/span&gt;        &lt;span class=&quot;rem&quot;&gt;/* Property cannot have base type of sObject to avoid querying related objects */&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   9:  &lt;/span&gt;        a.PropertyType.BaseType != &lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(sObject) &amp;amp;&amp;amp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  10:  &lt;/span&gt;        &lt;span class=&quot;rem&quot;&gt;/* Ignoring the properties that are of type QueryResult */&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  11:  &lt;/span&gt;        a.PropertyType != &lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(QueryResult) &amp;amp;&amp;amp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  12:  &lt;/span&gt;        &lt;span class=&quot;rem&quot;&gt;/* Let&#39;s make sure we don&#39;t query fieldsToNull property */&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  13:  &lt;/span&gt;        a.Name != &lt;span class=&quot;str&quot;&gt;&quot;fieldsToNull&quot;&lt;/span&gt; &amp;amp;&amp;amp;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  14:  &lt;/span&gt;        &lt;span class=&quot;rem&quot;&gt;/* We want to also ignore all boolean related fields that end with &quot;Specified&quot; */&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  15:  &lt;/span&gt;        !(a.PropertyType == &lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(&lt;span class=&quot;kwrd&quot;&gt;bool&lt;/span&gt;) &amp;amp;&amp;amp; a.Name.EndsWith(&lt;span class=&quot;str&quot;&gt;&quot;Specified&quot;&lt;/span&gt;))&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  16:  &lt;/span&gt;        ).OrderBy(a =&amp;gt; a.Name).Select(a =&amp;gt; a.Name);&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  17:  &lt;/span&gt;    &lt;span class=&quot;rem&quot;&gt;// Format the query string&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  18:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; query = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Format(&lt;span class=&quot;str&quot;&gt;&quot;SELECT {0} FROM {1}&quot;&lt;/span&gt;, &lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  19:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Join(&lt;span class=&quot;str&quot;&gt;&quot;, &quot;&lt;/span&gt;, sObjectProperties), sObjectType.Name);&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  20:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (binding != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  21:  &lt;/span&gt;    {&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  22:  &lt;/span&gt;        &lt;span class=&quot;rem&quot;&gt;// Send the query to Salesforce&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  23:  &lt;/span&gt;        QueryResult qResult = binding.query(query);&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  24:  &lt;/span&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (qResult.records != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp; qResult.records.Length &amp;gt; 0)&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  25:  &lt;/span&gt;            result.AddRange(qResult.records.Cast&amp;lt;T&amp;gt;());&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  26:  &lt;/span&gt;        &lt;span class=&quot;rem&quot;&gt;// Keep querying until we have all the records&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  27:  &lt;/span&gt;        while (!qResult.done &amp;amp;&amp;amp; !&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.IsNullOrEmpty(qResult.queryLocator))&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  28:  &lt;/span&gt;        {&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  29:  &lt;/span&gt;            qResult = binding.queryMore(qResult.queryLocator);&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  30:  &lt;/span&gt;            &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (qResult.records != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp; qResult.records.Length &amp;gt; 0)&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  31:  &lt;/span&gt;                result.AddRange(qResult.records.Cast&amp;lt;T&amp;gt;());&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  32:  &lt;/span&gt;        }&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  33:  &lt;/span&gt;    }&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;lnum&quot;&gt;  34:  &lt;/span&gt;    &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; result;&lt;/pre&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;  35:  &lt;/span&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Now you can query any Salesforce Object as such:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;csharpcode&quot;&gt;
&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;lnum&quot;&gt;   1:  &lt;/span&gt;    IEnumerable&amp;lt;Account&amp;gt; accounts = QueryObject&amp;lt;Account&amp;gt;(binding);&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Of course the world is not black and white, and you don’t always want to retrieve all the records in an Object.&amp;nbsp; I’m sure you can be creative enough to modify the method to suite your need.&amp;nbsp; Just keep in mind that Salesforce limits you to 10K characters for your query string, so if you have way too many fields on your object with very long names, this method will not works.&lt;br /&gt;
&lt;br /&gt;
In my next blog post, I will rewrite the above method so that it works with the Partner WSDL.&lt;br /&gt;
&lt;br /&gt;
Happy Coding&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://forceio.blogspot.com/feeds/7119864866458975714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://forceio.blogspot.com/2012/05/how-to-query-all-fields-in-your.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/7119864866458975714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9045857152608287021/posts/default/7119864866458975714'/><link rel='alternate' type='text/html' href='http://forceio.blogspot.com/2012/05/how-to-query-all-fields-in-your.html' title='How to Query all the fields in your Salesforce Object using Enterprise WSDL'/><author><name>Vahid Fotovat</name><uri>http://www.blogger.com/profile/08311933467452089240</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5qYi7GGKaT_zN96ZuZvgM2uLJl_hYvELXH3XkMvkyImBHOHRlCQz4EmELa8PqC-iEOqwBuKpsEiCaJkdBpiZUd34UiBlWgBPNzcBqiCaLal1-K1-165tgpFX08BK3Pwk/s220/IMG_2072.JPG'/></author><thr:total>0</thr:total></entry></feed>