Category: Code Sample
Email a Document with Salesforce.com
July 22nd, 2010, 2 Comments
After my last post, Create and Email a PDF with Salesforce.com, I received a few comments whether it was possible to do the same with Document stored in Salesforce.com. Could you choose a Document and then send it via email as an attachment? The short answer is yes! However, I tried to do it from [...]
Create and Email a PDF with Salesforce.com
July 16th, 2010, 5 Comments
This is a continuation of my post a couple of days ago, Attach a PDF to a Record in Salesforce, and shows how to dynamically generate a PDF and attach it to an email. The code is fairly similar and has the same issue with testing the PageReference getContent() method. You can run this demo [...]
Attach a PDF to a Record in Salesforce
July 14th, 2010, 5 Comments
Salesforce.com makes it extremely easy to generate PDF documents on the fly by simply using the renderAs=”pdf” attribute for the <apex:page> component. It’s also a snap to attach these PDFs to records as Attachments. Below is a small Visualforce page and Controller that generates a PDF and saves it to an Account. Note: there is [...]
Building a Dynamic Search Page in Visualforce
July 13th, 2010, 14 Comments
I brushed this code off and thought it might be useful to someone as a starting point for a dynamic search page. It has some cool functionality including passing search criteria via Javascript to the controller, search as you type, sorting of results by clicking on the column header plus much more. Hope you find [...]
Using RSA-SHA1 with Salesforce Crypto Class
July 6th, 2010, No Comments
This is a rather obscure post but it will definitely come in handy to someone trying to use the RSA-SHA1 algorithm with the Salesforce Crypto class. I’m spent the past two days trying to hook up OAuth using Apex and various Google Services. The standard HMAC-SHA1 algorithm is fairly straight forward with OAuth and Google [...]
Error Compiling Salesforce Metadata API with WSC
July 1st, 2010, 3 Comments
This might not be relevant right now but you may find it useful in the near future. I’m tinkering with an app that spits out documentation for an org. I really hate doing documentation and am quite lazy so I thought I’d write something to allow my computer to do my work for me. I [...]
Testing Salesforce.com Controller Extensions
June 2nd, 2010, 1 Comment
One thing that salesforce.com is working on is providing developers with a better testing environment. Salesforce.com requires you to write test cases to deploy your code to production but sometimes the process can be painful. Given the lack of something like jUnit you have to implement your own setup and test procedures. You’ll need to [...]
Java Command Line App Using the Salesforce WSC
May 17th, 2010, 3 Comments
The Force.com Web Service Connector (WSC) is a high performance web services stack that is much easier to implement than the “tried and true” Force.com Web Services API. Here’s a quick command line app you can use as a starter application. This class simply creates a new Account and then queries for the 5 newest [...]
Uploading an Attachment using Visualforce and a Custom Controller
April 28th, 2010, 3 Comments
This is a follow up post to Uploading a Document using Visualforce and a Custom Controller showing an example for uploading an attachment for a Contact. The Visualforce page and Controller is very similar with a few exceptions. Attachments are different than documents and are only available for the following objects: Account Asset Campaign Case [...]
Create a New Record in Force.com Sites
April 27th, 2010, 4 Comments
So someone asked me yesterday for some code to allow external users to create contact records in Salesforce.com. They needed a simple form where people could enter the details and once submitted receive a confirmation of what information was entered. Here’s what the final page that was developed looks like. You can try the code [...]










