Tutorial: Force.com for ASP.NET Developers

by Kavindra Patel on December 12, 2007 at 03:42 PM

MsdotnetUse the Force.com Web Services to access Salesforce.com data from with a Visualforce page and/or a Microsoft ASP.NET Web form. Go ahead and mash it up!
This article will take you through the process of creating custom Force.com logic, then demonstrate how to call that logic from within a Force.com application or from a custom application hosted outside Salesforce.com.

You can learn how to do the following:

  • Create a custom Force.com function and expose it as a Web Service.
  • Create a Visualforce application that calls the custom Force.com function and displays the results within a Visualforce page.
  • Create a Microsoft ASP.NET Web form that retrieves data from the Force.com Web Service and displays the results within an ASP.NET Web page.
  • Use an email address to look up a lead in a Salesforce.com account and return the lead’s listed mailing address, which can be used to pre-populate an online order form.

When you are done, you should understand how to do the following:

  • Use Apex code (a procedural on-demand language that is part of the Force.com platform) to expose a Simple Object Access Protocol (SOAP)-based Web Service from within Force.com.
  • Use Visualforce to consume the SOAP-based Web Service in a Force.com application.
  • Use Microsoft Visual Studio 2005 to consume the SOAP-based application from an external ASP.NET Web site.

Happy learning!
The Force.com Developer Team

Compression with .NET 2.0

by Simon Fell on December 7, 2006 at 09:25 PM

As some of you have probably already found out, the .NET compression tech note only works for .NET 1.1, I updated the code for .NET 2.0 (a process which largely consisting of deleting code that the framework now does for you), and posted a quick sample of how to use it.

resolution for datetime parsing issues with .NET 2.0

by Simon Fell on November 4, 2006 at 10:13 AM

A number of people have ran into issues where .NET 2.0 reports an error trying to parse a dateTime string. Eventually this was tracked down to a bug in .NET 2.0, there's a post of on the forums that has details of the problem, the hotfix from Microsoft and a workaround.

Open Source Portal for Salesforce (.NET)

by Nick Tran on September 11, 2006 at 09:55 AM

If you want an easy way to build and synchronize your .NET portal or website with Salesforce.com, then check out this toolkit from Cubic Compass Software.  Today they are going beta with their .NET Portal Toolkit for Salesforce.  It has some powerful features such as object replication and synchronization between .NET and Salesforce.com, post-processing on Web-To-Lead forms prior to sending the form data to Salesforce.com, and tracking web events in Salesforce.com.  I am particular impressed with its ease-of-use and also its attention to details (even having a navigation tree that mimics Salesforce.com).  You have full access to the source code since it is being released as open source software.

Be sure to check a live demo in the "Out of the Box: Portals and Web Sites Powered by AppExchange" session at Dreamforce 06 on Oct. 11, 2006 at 10:15 AM.

Biztalk 2006 Adapter for Salesforce.com

by Simon Fell on April 19, 2006 at 09:06 AM

Over on Jesús Rodríguez's WebLog, he mentions the soon to be released adapter for Biztalk 2006, and an upcoming webcast that discusses, worth checking out if your a Biztalk fan.

SforceHerder

by Simon Fell on February 19, 2006 at 01:00 PM

SforceHerder is a .NET 2.0 winforms app I put together that lets you explorer your Salesforce.com schema, includes source code (BSD license).

Sforceherder_t

Indigo with SForce

by Simon Fell on May 25, 2005 at 10:57 PM

Indigo

by Simon Fell on May 17, 2005 at 08:33 AM

Kirill, who works on Web Services interop at Microsoft has started a blog, and has a post with info on most of my previous issues with Indigo.

Sforce and Indigo

by Simon Fell on April 20, 2005 at 08:18 AM

Microsoft recently released a public build of Indigo (the March CTP build), You might be tempted to try it out with Sforce, I can save you some time, don't bother, it still has a quite a few issues that make it unusable as far as Sforce goes.

Sforce with .NET 1.1

by Simon Fell on April 5, 2005 at 01:12 PM

Using a .NET 1.1 client for Sforce works well, except for the following issues.

  1. If you're using VB.NET, then the generated proxy code will need modifying slightly as it doesn't correctly escape the case and event strings in all the right places, see this post on the community forums
  2. Not all types support null in .NET (doubles, ints, dateTimes), in the generated proxy fields of these types will have an additional boolean that is the null flag for that field. For create & update calls, to set one of these values you must set both the value and the additional flag (has the same name with specified appended to it), e.g.
         sforce.Account a = new sforce.Account();
         a.AnnualRevenue = 10000;
         a.AnnualRevenueSpecified = true;

.NET tip for queryMore

by Simon Fell on March 15, 2005 at 07:47 AM

A lot of code using the Sforce API deals with calling query and queryMore, probably using something like this

sforce.QueryResult qr = svc.query("Select Id, Name from Account");
do
{
foreach (sforce.Account a in qr.records)
{
processAccount(a);
}
if (!qr.done)
qr = svc.queryMore(qr.queryLocator);
else
break;
} while (true);

But the .NET Web Services client stack gets an async client API for free, this lets you easily start the queryMore call before you start the job of processing the current records, so when you've done with the current records, the next are ready for processing, no need to wait around for the queryMore call to hit the network and comeback. If you're processing millions of records, then this can add up, here's a revised approach

sforce.QueryResult qr = svc.query("select Id, Name from Account");
IAsyncResult asyncQueryMore = null;
do
{
if (asyncQueryMore != null) qr = svc.EndqueryMore(asyncQueryMore);
if (!qr.done) asyncQueryMore = svc.BeginqueryMore(qr.queryLocator, null, null);
foreach ( sforce.Account a in qr.records)
{
processAccount(a);
}
} while (!qr.done);