PDF Headers and Footers with Visualforce

by Patrick Connelly posted on April 04, 2016

Over the past couple of months, I’ve seen several posts on the Developer forums asking how to set PDF headers and footers with Visualforce. I decided to sit down and try my hand at it. If you have done the Battle Station app on Trailhead, you can try this out on your own sandbox! We will be generating a PDF invoice for the Battle Station app that includes a first page header image and a dynamically generated footer.


Rosetta Code: A call for help

by Patrick Connelly posted on March 27, 2016

If you’ve ever started to learn your second programming language, you know how important it is to have example of the new language to help you understand the syntax. In my opinion, once you’ve learned the concepts behind programming (loops, control statements, etc) it’s pretty much just learning the syntax to get started. That’s where the folks over at Rosetta Code come in, to make it easier to learn new languages.


Testing NOW in Apex

by Patrick Connelly posted on March 21, 2016

If you’ve ever written a trigger that stores Date.now(), then this scene from Spaceballs may seem very familiar. This is how I feel when testing now.

Testing now

  • Dark Helmet: What the hell am I looking at? When does this happen in the movie?
  • Colonel Sandurz: Now. You’re looking at now, sir. Everything that happens now, is happening now.
  • Dark Helmet: What happened to then?
  • Colonel Sandurz: We passed then.
  • Dark Helmet: When?
  • Colonel Sandurz: Just now. We’re at now now.
  • Dark Helmet: Go back to then.
  • Colonel Sandurz: When?
  • Dark Helmet: Now.
  • Colonel Sandurz: Now
  • Dark Helmet: Now.

The problem comes down to knowing when now is. Obviously, now is something that’s in constant flux and will change throughout your test. But there are ways to be able to know when now really is in your test.


Extending objects for JSON parsing

by Patrick Connelly posted on March 16, 2016

In a previous post, I talked about how to pull Runkeeper data into Salesforce. The key portion of this revolved around JSON parsing of the data into Apex classes. In this post I’ll talk about how to use Object Oriented structures to extend the classes previously written to support additional data.


2 Years of Running

by Patrick Connelly posted on March 07, 2016

Back in 2013 a couple of folks from the Salesforce community challenged each other to do the Runners World Run Streak. Eight of us started the challenge of running at least one mile a day for 35 days. Of those eight, four completed the challenge. This sparked a fire in me to try to keep the streak alive. Starting November 28th 2013 I ran at least a mile a day until February 23rd 2013 (88 days) when my son was born. After a little more than a week off (which felt like a lifetime) I picked back up and decided to keep the streak going for as long as possible. Yesterday (March 6th) marks two years of running every day. I wanted to take a little bit of time to put down what I’ve learned about running and about myself over these two years.


Runkeeper data in Salesforce

by Patrick Connelly posted on March 01, 2016

Runkeeper and Salesforce

For the past couple of years I’ve dabbled in running and getting data from Runkeeper. I decided that I’d give it a try to have the entire process inside of Salesforce. This provided an interesting challenge for me, since it’s the first time I’ve setup the oAuth flow from Salesforce back to Salesforce. This post will likely be the first of a couple in this theme of pulling data from Runkeeper. The code included here is just a base for what can be done. I’ll be maintaining an updated version of the RunkeeperUtils class on my github, so make sure you check there for the most recent version of everything. So let’s go over how we can do this


Trailhead: Navigate the Salesforce Advantage

by Patrick Connelly posted on February 22, 2016

Trailhead: Navigate the Salesforce Advantage

The Trailhead team released another set of fantastic modules this past week. But unlike many of the other modules, these delve into the world of Salesforce itself, and not really into Salesforce the product. Let’s take a look into each of these modules a bit deeper.


Amazon S3: Attaching a File in Salesforce

by Patrick Connelly posted on February 16, 2016

Last week I covered how to send an attachment from Salesforce to Jira. This week we’ll cover how to attach a file from Salesforce into the Amazons S3 cloud. Unlike the Jira uploading, we will not be associating these files with a specific case, but instead will be uploading them to a generic bucket. This can be modified by changing how the filename is generated on line 8 of the code.


Jira: Attaching a File in Salesforce

by Patrick Connelly posted on February 09, 2016

I was recently challenged with the task of sending an attachment from Salesforce to Jira. Looking over the documentation, this doesn’t appear to be too hard. The toughest part is that Jira wants a multi-part form upload for the attachments and this can be a bit of a headache to do in Apex. Following this post as a guide for multi-part form upload, we can adapt it to the format that Jira expects.


SSL and Outbound Messaging

by Patrick Connelly posted on February 01, 2016

Recently I started setting up some Outbound Messaging to I needed to set up a blackhole (messaging sink) for messages to go to until we had stood up the real messaging endpoint. To host this I setup a simple nodejs service on our company’s externally available (but internally hosted) instance of Openshift. This service simply sends back the appropriate ACK for any XML that is POSTed to it.