Come see me talk about SQL Server and Lightning Connect at Dreamforce 2015

LightningI am happy to say that I will be presenting again at this years annual Dreamforce, Wednesday September 16, 2015 at 9:15am. The session is titled, “Exploring SQL Server Azure Database Relationships Using Lightning Connect, and I should be in the Mobile Theatre in Moscone West.

Lightning Connect is what I consider to be a game changer in the world of Integration. It allows you to easily (and the key word here is easily) setup a real-time connection between your external data and Salesforce.

After setting it up, you can query external data from within Salesforce just like you would any other sObject. No exhausting setup of some overly complicated publishing/subscriber model (which is something I myself have unfortunately been involved with). No, you just publish your data as oData, setup an external data source in Salesforce, define some external relationships, and off you go.

Now, as with any new technology like this, there are a few gotchas to be considered. I will be covering some of these, as they pertain to setting up a connection to communicate with a SQL Server Relational database hosted on Windows Azure. The key takeaways I hope to communicate during this session will be:

  • What you need to know to work with Visual Studio and SQL Server Azure
  • How quick and easy it is to setup a connection and query data one-way in real time
  • What you need to know to define relationships in Salesforce

Hope to see you there!

How to Set the API Version using the Force.com Toolkit for .NET

toolkitIf you are doing Salesforce Integration work and working with the REST API, then you have probably already heard about the Force.com Toolkit for .NET. But, because the toolkit is unfortunately not very well documented, you probably had no idea that it defaults to using version 32 of the REST API. You also probably had no idea that you can change the api version (like to the latest version, which is currently 34) using the Toolkit.

Don’t worry, I had no idea either and I have worked with the Toolkit quite extensively. In fact, when I discovered that it was using version 32, I actually reported it as an issue (since the Toolkit is Open Source). However, as the projects owner (Wade Wegner) graciously pointed out to me, this is a purposeful feature of the Toolkit. As he states, “The SDK is designed to make it easy for you to change the API version yourself programmatically but defaults to the last known working API version. That’s not to say it won’t work with v34, only we haven’t tested it.”

So, now you may be asking, “Ok, so how do I change it?”

Glad you asked, since that is what this post is about. Turns out to be pretty easy (since the Toolkit is pretty slick like that).

The ApiVersion property can be set or retrieved after authenticating using either the UsernamePasswordAsync or WebServerAsync methods. For example, if I were to place a line of code like this in a console application after authentication, I would expect to get “v32.0” printed out to the console:

await auth.UsernamePasswordAsync(consumerKey, consumerSecret,
        username, password + token, url);
Console.WriteLine("Sucessfully Logged in. You're default API Version is: " 
        + auth.ApiVersion);

Now if I want to set it to the latest version (which is 34), I can pass that in when I get an instance of the ForceClient, which is needed to perform any operation using the Toolkit. The code to set the ApiVersion to 34 would simply look like this:

var client = new ForceClient(auth.InstanceUrl, auth.AccessToken, "v34.0");

That’s it. Just remember that the ApiVersion is a string and that it must be formatted like this: “v34.0”. Passing in “34”  or 34 will not work and will get you errors, in fact. Not sure I like that part so much, but just glad I can set it to what I want.

BTW, I tested that this would work using the Sample Console app and setting the version to 34 and it worked splendidly.

Hope that helps someone out there.