Salesforce & LinkedIn Developer API: 401 – Unauthorized

I’m not going to get into the boilerplate code you’ll need in order to get OAuth up and running as it’s pretty straight forward, but I did run into a peculiar issue which took me some time to narrow down. To reproduce these steps you’ll need to: Correctly setup OAuth between the Force.com Platform and LinkedIn Authorise access to your LinkedIn account Attempt to fetch a resource using an API endpoint such as: http://api.linkedin.com/v1/people/~/network/updates?scope=self When attempting to make the call out in step 3 you’ll get a “401 – Unauthorized” error. So to be clear OAuth is working perfectly but a call like this one will still result in the error. After some troubleshooting I noticed that some API endpoints didn’t result in the error e.g. http://api.linkedin.com/v1/people/id=abcdefg/network/updates?scope=self. At this point I realised the issue was probably the tilde (‘~’) character in the URI. Grasping at straws I manually replaced the tilde with …

Read more

Across the Pond with Jason Venable aka TehNrd

Today I start a series of posts that’ll appear here and on the Tquila blog. The series will be in the format of Q&A with some of the finest Salesforce.com and Force.com evangelists, admins and developers. I’m starting with Jason Venable aka TehNrd and I’ll let him introduce himself. Q: Tell me a bit about yourself. How long have you worked with the CRM vs the Force.com Platform? Were you always a developer? A: My name is Jason Venable. I am 27 years old. I live in Seattle, Washington, USA. Oh, wait, you want something more interesting, got it. I’ve been working with salesforce.com CRM for a little over 4 years. Three of these years have also been working with force.com. All of this time has been administering and developing for a large enterprise salesforce.com deployment at F5 Networks. A lot of what I do is merging the two worlds …

Read more

Salesforce: Force.com Sites and Google Analytics

This is a cross-post from the Tquila blog. Not having analytics built into your public sites is much like having a Q&A site but not allowing people to answer. In this case some of the questions are: Where did you come from? How long did you stick around for? Where did you hang out on your visit? Now I’m not going to debate which set of analytics is best but I did come across a few quirks when setting Google Analytics (GA) up for wesnolte.com that I suspect are fairly universal. Build a Site This of course is quite a big step and I’m going to assume you’re just about done. To get analytics up and running though you’re going to have to do a few extra bits. Sign up for a GA account, create a Website Profile and you’ll receive an Analytics Code. My code has been blocked out …

Read more

Cloud Computing – A Programmer’s Implementation of Hardware and Software Infrastructure?

Yes, it’s a sweeping statement, and the comparison I’ll make probably doesn’t fill every nook and cranny but it’s just so darn tasty that I had to quickly knock something out. I think that the developer collective have a massive influence over the direction of software evolution, and therefore it’s underlying technologies. In times gone past the influence probably wasn’t so large (or was it Mr Turing?), but with the rise and rise of the Socially Networked era I think the effect has snowballed. So where is my justification? Well it lies primarily in anecdote – yes yes I hear your nerdy cries you sons & daughters of empirical science, but hear me out m’kay. We, the developers, spend probably more time online than even an opposite-sex obsessed teen does on facebook (yes, I know it’s part of the internet). We search and we scrounge, getting easily bored and looking for the …

Read more

Salesforce: Programmatically Populating Sample Data Post-Deployment

I’m not sure if this concept is obvious when reading my previous post, so I thought I’d run through it with a specific example.

Rule one of packaging – Finish your bolognese first!

Let’s say that you’ve created what can only be described as an exemplary application in the form of a Managed Package. Although your user interface is beyond compare, you’d also like to populate some of your core objects with example data. Some options that immediately spring to mind are:

  1. Get the person that installs the package to call you, and you can do it post-installation.
  2. Get the person that installs the package to create sample data manually post-installation.
  3. Give the user a “Start Here” page with a call-to-action – such as a commandButton – that fetches the data from some API and parses into object data.

Option 3 is pretty excellent, especially now that you can package Remote Site Settings but I think we can do one better. And when I say better I mean simpler and with fewer potential points of failure.

Read more

Salesforce: Instantiating an SObject Dynamically at Run-time

I’m sure a lot of you have this documented somewhere but I’ve recently discovered that it’s quite difficult to find an obvious reference to this knowledge on the interwobbles. So how would you create a Generic SObject at run-time? It’s rather easy thankfully: If you require this type of functionality quite often I’d suggest putting it in a utility class.

Salesforce: Enhanced Custom Settings

Okay book’s done, now where were we? Oh yes software development, right? Programming software engineering application development h4x0R-ing. Oh how I’ve missed getting my mitts dirty so without further ado…

Now this one goes right about... here!

Some time back Custom Settings were introduced on the Force.com Platform and we all star-jumped in the air, w00ting to anyone who would listen. Up till this point – if you’re anything like me – you were using custom objects to hold configuration data, whether this be lists of language-codes, or operational settings such at outbound web service endpoints, usernames, passwords etc. With Custom Settings you finally had a place to put this information – a home if you will – for your lonely, orphaned Control Data.

Quite quickly however I realised there was still a gaping hole that could be filled with Custom Settings but just didn’t feel right. Lists of data (such as currency codes and descriptions) fit really well into this structure but more serious Control Data that you only need to be listed once-off (such as important URLs, flags to active/deactive modules in your application, usernames and passwords) just don’t seem like they really belong with this other crowd. A quick list of reasons highlights this:

  • Control Data is typically entered once off and creating an entire Custom Setting for a single line of data feels like a waste.
  • Custom Settings are data so they can’t be deployed with code, they must be created after the fact. Control Data should be a little more important than regular data, it needs a smarter vehicle than plain-old data entry.
  • If you’re creating packages you want as much autonomy for your clients as possible. If you use custom settings there will have to be that “Create data in Custom Setting X__c” step in each and every deployment.

    Read more

Salesforce Handbook Review – salesforce.com developer evangelists

I know I’ve been laying low for the past few months, but Jeff Douglas and I have been hard at work writing quite a large book (man are my fingers tired!). We passed the book around to some of the trusty ol’ Salesforce gurus, and even one or two salesforce.com developer evangelists to get their input; so let me bait you with the most #awesome review that Quinton Wall (esteemed fantasy writer and salesforce.com developer evangelist) gave us right off the bat! ”The developer.force.com community is the best resource for anyone wishing to learn more about the Force.com platform. Jeff Douglas and Wes Nolte, are two of the communities most active and respected members. The Salesforce Handbook is as close as you can get to bottling the combined experience of Jeff and Wes into a book designed to get new developers building apps in no time. They just made my …

Read more

Salesforce: System.Assert vs System.AssertEquals

For a time I’d wondered what the difference between the System.Assert and System.AssertEquals methods might be (System.AssertNotEquals to a lesser degree). To be honest this tip isn’t going to help much with World Peace or Curing Internetlessness, but it’s certainly gonna save you some time. Looking at the documentation there are some obvious differences. Pretty standard stuff, and can all be learnt simply by Reading The Manual. Now testing best practices state that you should assert some condition but also output a “console” message that shows the values of each of the operands. This certainly helps you debug unit tests when asserts are failing, but man I hate typing extra code just to check out some variable values! So the time saving trick that isn’t obvious is that when omitting the optional third parameter for System.AssertEquals and System.AssertNotEquals the compiler automagically outputs the values of the operands to the console …

Read more

Announcing the Salesforce Handbook

Recently, Jeff Douglas and I saw the potential for a beginner’s book – aimed at business owners, analysts and developers, that comprehensively documents Salesforce and Force.com. There is a tonne of documentation out there and we thought “Wouldn’t it be nice to have a handbook that lightly summarised the most important areas of the platforms as well as offering some best practise advice”. We mulled it over for a time, and today we’d like to announce that we’re currently writing: The Salesforce Handbook A newcomer’s guide to building applications on Salesforce.com and the Force.com Platform. Hand-in-hand with the book we’ll be publishing content from the book on a WordPress site. Here you can expect to find excerpts from the book, but also content that supplements the book e.g. areas that’ll serve as best-practice hubs with links to official documentation, blog posts that rock the party, and even superb discussion forum …

Read more