12 December 2013

Using the Force.com Command Line Interface


Tools, tips, and tricks are the lifeblood of a salesforce hacker.

At Dreamforce 2013, Dave Carroll announced a fantastic new Command Line Interface (CLI) tool that administrators can use when managing their organization.

Some of you are probably thinking, 'how cool!'. But for others, a CLI is not usually thought of as a 'cool' administrative tool outside of managing a Unix server or as a developer tool for uploading code to GitHub.

However, a CLI is a fantastic tool for going bare metal when it comes to managing your organization. You can do truly amazing things when you combine the power of querying the platform with many of the MacOSX terminal commands like 'grep'.

For instance, I can quickly query all of the permission sets assigned to a specific user:


Using standard terminal commands helps me more easily navigate data I want to review. For instance, if I want to check just the name of the user who is currently logged into to CLI, I can filter any field with 'Name' in it using grep:


However, if I just want to know the actual name of the user, I can add the regular expression '^' caret to mark the beginning of a string, in this case the 'Name' field:


Now I've combined the power of the force.com platform with terminal commands and regular expressions, all in one easy to use tool. This translates as more power than what I have with other tools in a much simpler format than other user interfaces I'm used to using. 

You can download the Force.com CLI from https://force-cli.heroku.com/. There's also a fantastic blog posting from Wade Wegner to help get you started.