jQuery Org Chart – a plugin for visualising data in a tree-like structure
jQuery OrgChart is a plugin that allows you to render structures with nested elements in a easy-to-read tree structure. To build the tree all you need is to make a single line call to the plugin and supply the HTML element Id for a nested unordered list element that is representative of the data you’d like to display. Features include:
- Very easy to use given a nested unordered list element.
- Drag-and-drop reorganisation of elements.
- Showing/hiding a particular branch of the tree by clicking on the respective node.
- Nodes can contain any amount of HTML except
<li>and<ul>. - Easy to style.
Expected Markup & Example Usage
All documentation can be found on github.
Demo
You can view a demo of this here.
Sourcecode
Source code with an example is available here.
Salesforce: Different percentage code coverage in different environments

Spot the difference.
Many people are finding that their tests are reporting different degrees of test-coverage in different environments. There are a few things to check if you are getting inconsistent results but there’s a new bug in the wild. Before you assume you have the bug make sure that you’ve:
- ‘Run All Tests’ in each environment. This will tell you a few things viz.
- Perhaps there are tests failing that are bringing coverage in that environment down.
- There are some tests that only fail when run in the browser e.g. MIXED_DML_EXCEPTION will not rear it’s head through the IDE.
- Click the ‘Compile all classes’ link above the Setup > Develop > Apex Classes view. I’m not sure when this lil’ bugger first appeared but it’s darn useful. Essentially it makes sure that all the dependencies in your code are fulfilled e.g. if page A uses controller B that in turn refers to utility class C it’ll make sure each of those pieces exist and work (as far as compilation goes at least).
- Double-check your test classes to make sure they’re not data dependent. If they are and you have different types/amounts of data in your respective environments it’s 100% feasible that the test coverage will be different.
Now if you’ve checked all of the above you might have been afflicted by a new bug which, for some reason, counts braces, whitespace (and more!) as being uncovered by your tests. This is preposterous of course and to fix it simply remove all test history from the deranged environment. Re-running the test and/or deploying them should now be back to normal!
Salesforce: Stop email being sent on user creation or password reset or …
I’ve had to do this a few times but infrequently enough for me to forget how to do it each time. Forgetting things isn’t usually an issue because of our Google Overlords and their mighty The Google but it’s quite a journey down the rabbit hole to find this specific information.
The reasons it’s tricky to find is because the setting that controls whether an email is sent to the user on creation is not directly associated with users but with DML. Long story short you need to set a particular Database.DMLOption e.g.
User u = new User(); // Add some details here ... // Set the DML options Database.DMLOptions dlo = new Database.DMLOptions(); dlo.EmailHeader.triggerUserEmail = false; Database.insert(u,dlo);
Hopefully this information will now be easier to find next time I forget
A gem to help you document your Rails ActiveRecord model
I’ve been using the “annotate” gem for a while and it’s simple whilst incredibly useful. Essentially once run it documents each resource in your database within the appropriate file. Here’s how to get it working.
Step 1
Install the gem. There are a few ways to do this but I usually include the following line in my Gemfile:
gem 'annotate'
Then run “bundle install” from the command line.
Step 2
Generate the schema annotations by running:
annotate
in the root of your rails project directory and it will inject the schema details for each “table” into the respective “model.rb” file e.g. “user.rb” might contain:
# == Schema Information # # Table name: users # # id :integer not null, primary key # screen_name :string(255) # name :string(255) # created_at :datetime # updated_at :datetime #
Knowledge Tree for Salesforce User Roles

UX that makes you say things like, "Gee Whizz" and "Cowabunga"
Many moons ago @ratherGeeky was searching for an AppExchange app that would neatly display user roles so that she could be the best admin she could be. I had a poke around and there were a few nice apps out there but nothing with a simple, neat display of user roles.
Since then CloudSpokes was created, and a competition to that effect was released using the concept and tools that I was going to use (@jeffdonthemic smells like turnips btw). The outcome of the competition was a few very cool apps, but nothing that was package-ready so I pressed ahead anyway.
I’m happy to announce that you can now get Knowledge Tree for Roles on the AppExchange for free. It’s definitely a point solution, very specific in the problem it’s trying to solve but I think it does that well. I have a roadmap for the product and will [ever so slowly] be releasing new features e.g. drag and drop will be killer.
I
f you install the app and like it then please, please, please (please (please)) review it as it helps exposure and will hopefully lead to me getting more time to work on it. If you don’t like it let me know why via email (wes@cloud-corporation.com) and I’ll do my best to turn your frown upside down.
Across the Pond with Shannon Hale
@abhinavguptas and I were curious as to the identity of the creator of the SetupScripter, which is now incorporated into the salesforce.com Org setup menu. I dug around a bit and managed to uncover her real identity – community please meet Shannon Hale, Shannon Hale this is the community. She didn’t just stop with that wonderful piece of UX but has moved onto bigger and better things, but I’ll let her tell you about those.
If you’d like to learn more about the genius that is Shannon or just have a chat with her you can get her on twitter at @shannonsans or @bathtubdreamer. You can also check out her online presence at shannonsansserif.com and bathtubdreamer.com.
Onto the Q&A!
Who is Shannon Hale? How did you get into software development and UX design?
I started out as a writer, but in a different field — I wrote and edited for some independent Canadian music and culture magazines. I started technical writing to help pay the bills, and from there wandered through a series of tech positions: technical training, systems analysis and design, and software development. In 2001 I became obsessed with why a product I was coding was difficult to use, and began to independently study interaction design and user experience.
When I’m not being a complete geek — which I am even at home, I always have personal and volunteer web projects going on — I’m sewing, knitting, or binding books. I’m one of those people who always needs to be doing something with their hands.
“Dropping” a mongohq database on Heroku
I’ve used inverted commas around the word ‘dropping’ because it doesn’t look like you can drop a mongohq database – what you can do however is drop all the collections in the database. I was doing this through the add-on interface in heroku but that got tired quickly, and after some googling it looked like the solution was to write a custom rake task and drop it into lib/tasks/; the file can be named anything with a ‘.rb’ extension. The code follows:
namespace :mdb do
desc 'Drops all the collections for the database for the current Rails.env'
task :drop => :environment do
if ENV['MONGOHQ_URL']
uri = URI.parse(ENV['MONGOHQ_URL'])
conn = Mongo::Connection.from_uri(ENV['MONGOHQ_URL'])
DB = conn.db(uri.path.gsub(/^\//, ''))
DB.collections.each do |collection|
begin
collection.drop
rescue
puts "Can't drop: " + collection.name
end
end
end
end
end
Note that the exception handler isn’t perfect and essentially all I’m doing is skipping the system collections that can’t be dropped.
Once you’ve deployed this code to the heroku servers it’s simple to execute:
heroku rake mdb:drop
London Force.com Meetup – 20 October 2011
Yip it’s that time again and boy do we have some very cool speakers this time around. The gig is at Skillsmatter at 6.30pm on 20 October and is summarised in the info below. Please don’t forget to RSVP. Of course there will the be usual beers and pizza
Hope to see you there!
AMJAD KHAN ON FORCE.COM ERD USING SCHEMASPY
Amjad Khan will give a talk to the SafesForce user group on How to Install and run SchemaSpy on any Salesforce Org to generate an ER diagram. More details…
SIMON GOODYEAR ON MAKING BETTER USE OF INTERFACES ON THE FORCE.COM PLATFORM
Simon Goodyear’s talk for the SalesForce user group will give a quick overview on what interfaces are, how you can make better use of them in APEX, and what we gain from doing so. More details…
TESTING ON THE FORCE.COM PLATFORM
Keir Bowden gives a talk for the SalesForce User Group on Testing on the force.com platform, covering TDD, unit testing, continuous integration and test scripting. More details…
EFFECTIVE B2C MANAGEMENT
Stony Grunow gives a talk for the SalesForce User Group on Effective B2C management for companies using the “Contacts and Organisations” package. More details…
TURNING YOUR ORG INTO A FULLY OPERATIONAL BATTLE STATION USING RUBY AND SELENIUM
Bruce Durling will give a talk for the SalesForce User Group on turning your org into a fully operational battle Station using ruby and selenium More details…
Logging into Salesforce through the Web Interface

You Shall Not Pass!
There are a number of ways to authenticate with the Force.com Platform and I thought I’d create a few lightning posts documenting my findings for each.
The first method in this series will be logging in through the web interface. There are 2 sites that you would hit in order to authenticate:
- http://login.salesforce.com – for Developer Edition and Production Orgs
- http://test.salesforce.com – for all other sandboxes
If you’re not able to log in with a username and password that you know is correct then the first port of call is to check that you’re using the correct URL above. I’ve seen many developers forget to hit ‘enter’ after swapping “test” for “login” (or vice versa) and then being puzzled because their credentials still didn’t work so don’t forget (okay by “many developers” I actually mean me).
There’s also a neat trick that’s quite well-known and can be used to log you in automatically based on bookmarked URLs. All you need to do is append 2 URL parameters onto the appropriate environment HTTPS URL e.g. I could create a bookmark with the URL https://test.salesforce.com?un=wes@cloud-corporation.com&pw=abc123 where:
- un = your username for that environment
- pw = your password for that username
Pro-tip: Make sure that the URL is using HTTPS.
If you exclusively use Chrome you might want to use the Force.com Logins plug-in which will save you some hassle.
Ruby, Rails & RVM woes
I’ve had several issues over the past day pertaining to Ruby, Rails and RVM and all of them were caused by one silly thing.
Problem 1: You can’t swap between Ruby versions using RVM
If you can’t swap between Ruby versions that you know you’ve installed then you’ve probably installed something using “sudo”. It is highly recommended that you install & use RVM in the single user mode as this is easiest. If you do this then all the versions of Ruby etc. that you install will be installed in your home directory (usually ~/.rvm/) instead of system wide and this negates a whole bunch of complexities. Running this command will tell you which ruby executable you’re using:
which ruby
If the executable is not sitting in your home directory e.g. it’s in /usr/local/bin then you’re in a spot of bother. The easiest way I’ve found to fix this is to clear out all the RVM gemsets and start again. I’ve found that I needed to run:
rm -fr ~/.rvm rm -fr ~/.bin
Be careful with the second command. I’d have a look around that directory before deleting it to make sure it’s not being used by anything else.
Having wiped out these directory you can now using RVM to install fresh versions of Ruby.
Problem 2: Running “rails -v” or “rails” throws an error similar to “`report_activate_error’: Could not find RubyGem rails’
This is assuming you don’t have the first problem or that you’ve corrected it. It’s also most likely to occur if you’re using RVM. The cause here is that you’re using a local version of RVM to manage your Ruby versions but have installed Rails using “sudo” so that it’s been installed system wide. The solution is simple, remove the “sudo” so that rails is installed just for your currently active gemset.
gem install rails --version x.y.z


