Salesforce: Universal Batch Scheduling Class

I’d like to propose a new way of working with scheduled batch classes. I’ve worked on several hundred Salesforce projects in the past few years and often see batch scheduling classes being created per scheduling requirement and it grinds my OCD – not in a good way. In most cases you should only need one “Batch Scheduler” per Org, let me demonstrate how and why. The Universal Batch Scheduler™ Requirements Let’s assuming you have a batch class that you need to run on a repeated schedule*, such a class signature is given below. That class will have to obey some conventions such as implementing the Batchable interface as shown in the standard documentation. [code language=”Java”] global class MyBatch implements Database.Batchable<SObject> { // … } [/code] * For one off, schedule execution of batch classes you can use the System.ScheduleBatch() method. The Scheduler Now you might be tempted to created a scheduled …

Read more

If This Then Salesforce

I’ve been enjoying IFTTT for a while now and if you haven’t experimented with it yet then I’m not sure we’ll ever be friends. Essentially it’s a very easy tool that lets you set triggers on a source API e.g. Foursquare and have some information from that API be posted to a target API e.g. Jawbone Up. IFTTT calls these recipes and I’d like to demonstrate some particularly delicious combinations that can be used with Chatter. Salesforce Org Alerts and Known Issue posted to Chatter Salesforce makes Instance Alerts e.g. “Perfomance degradation on EU0.” available through an RSS feed so all you need to do is create a recipe (or copy mine) that monitors the appropriate RSS url for changes and posts to a particular Chatter group. You can do a similar thing with Salesforce Known Issues. Tweets posted to Chatter Quite often there are interesting tweets that I want to …

Read more

Salesforce Analytics API Sample Code

A picture is worth a thousand words, so goes the justification for graphic novels. I kid, I love the hell out of graphic novels but now I’ve been sidetracked and this is only the second sentence of this post. So, the Analytics API. I’m pretty enamoured with it as it seems is Pat Patterson, and I think that it’s one of the most useful features the platform has ever made available. Presenting the right chart (or set of charts) to a manager or executive can empower them to make business decision in minutes, powerful stuff. To that end myself and a few of my fellow Tquilites have begun building an opensource library of Analytics API demos to aid you in aiding your clients/managers/execs. Below I’ve included a few introductory steps to help you get started. To start with you’ll need the code from github. Step 0 I’ll be stepping through …

Read more

Developing Chrome Extensions for Salesforce

Chrome extensions are awesome, they provide amazing convenience that is limited only by your imagination. There are some amazing Chrome Extensions for Salesforce already, some of my favourites being: As a great fan of JavaScript I’ve always wanted to create a Chrome Extension for Salesforce and I’ve finally gotten around to it. The hardest part was figuring out what context the JS executes in (e.g. in the current tabs context, or in some separate context). Let me step through the code to show you how it’s done. Chrome Extension Structure A Chrome Extension is made up of a JavaScript, HTML, images and JSON. At its core is a manifest file which contains the metadata describing your application in JSON. There is a lot of documentation about the structure of this file but some of the key elements are shown below. This file references all external resources (JavaScript, images etc.), the …

Read more

Salesforce: Files vs CRM Content vs Knowledge vs Documents vs Attachments

Choosing the right file or document management system on- (or off-) platform can be a difficult decision, and one of those things that’s difficult to change once implemented so it’s important to make the right choice up front. Salesforce.com has a number of content and document solutions (and more on the way) and the options when given a set of decision points aren’t always clear. To this end I’ve created a matrix comparing the on-platform systems which should make that decision easier. It’s based on the official documentation but add in a few other key decision points (please don’t sue me Salesforce, I’m just a lowly a certified technical architect!). If I’ve got anything wrong, or left something out please let me know.

Salesforce User License Feature Matrix

Understanding Salesforce licensing is incredibly important for all areas of a business buying salesforce and implementation projects. Common questions are: What licenses are available? How much do they cost? Which license types support my intended solution? What are the limitations? How are they “consumed”? As part of my Salesforce TA Certification I created a matrix that compares all current license types making it easy to learn about licenses and make the licensing decision a bit easier. The matrix isn’t comprehensive but instead tries to balance ease-of-use whilst providing the most important decision points. Let me know if I missed anything important! References User license types Getting started with communities

Salesforce Certified Technical Architect

Fall seven times, stand up eight. – Japanese proverb Finally, I have this certification. This has been a journey for me, and taken much longer than I anticipated. I did fail the first attempt, but was given a retry (make-up exam) in the sections that I’d failed. I subsequently failed that too. My second, full attempt saw me pass, and in fact I found it quite easy so let me help you learn from my mistakes. Attempt 1 Late last year I booked in my board review exam. I’m not going to go into the detail of what the board exam entails it’s because this has been discussed in detail here, here and here. I spent a lot of time preparing, and had some ad hoc coaching from the UK SFDC certification team but in the end the hypothetical exam destroyed me. Here’s why: I’d been developing apps for nearly a …

Read more

Salesforce: Sharing Cheat Sheet

Sharing is complex, but necessarily so. It gives you incredibly fine-grained control over data access through it’s flexibility but requires quite a deep understanding to do it properly. There are great articles out there that describe sharing in detail e.g. Force.com object and record level security An Overview of Force.com Security I don’t want to recreate what’s in those articles, instead I’m providing a short, sharp cheat sheet of the major topics you need to understand. So without further ado… Sharing Cheat Sheet Sharing Metadata Records Implicit Sharing Organisation-Wide Defaults (OWD) No Relationship Master Detail Lookup Manual Sharing Apex Managed Sharing Recalculation Choosing the Right Share Type “Traditional” / Ownership-based Sharing Rules Criteria-based Sharing Rules Apex Managed Sharing Rules Manual Sharing Rules Share Groups Sharing Sets Portals High Volume Portals (Service Cloud Portals) other portals Large Data Volumes If you’ve got any other items you think should be in this …

Read more

Salesforce: Insufficient privileges when trying to access Activity Settings

This strange issue blocked access to certain areas of the setup menu in my production Org, and I couldn’t find a comprehensive solution so here we are. The problem is documented most comprehensively here with problem statement as: If you choose to show a custom logo in meeting requests, if the admin who specifies the logo specifies a document that other admins cannot access, then other admins will be locked out of the entire activity settings page. If the file was created in the last six months you can find out which fart-face did this and have a quick chat with them. However, if the change was made more than 6 months ago you’re in a bit of a sticky situation. The advice of the aforementioned document is to contact salesforce.com support and ask them to let you know who owns the file. However, you can do this yourself using …

Read more

Salesforce JavaScript Remoting: Using Apex and JavaScript objects to pass data from client- to server-side and vice versa

I’ve spoken about how to do this at a high level during Cloudstock London and there are hints at how it can be done but no formal documentation that I’ve found, so here we are 🙂 Quite simply JavaScript Remoting will transform Apex objects and classes (or collections of these types) into JavaScript objects for you. The opposite is true too but there are some rules you need to observe. Apex Types to JavaScript Equivalents This is the easier of type conversions in that you don’t have to really do anything to make it happen. The code below uses a custom class that I’ve defined but you can do the same with any sObject too. Let’s have a look at the code. The Controller The Visualforce The Output JavaScript Types to Apex Equivalents This is a little tricker, especially when it comes to sObjects. Note that the approach below works for …

Read more