Tuesday, October 16, 2012

Adding Dropbox SDK to a maven build

Unfortunately the Dropbox Java SDK is not available in a public maven repository. The quick and dirty work around is to install the jar to once local ~/.m2 directory using the following command;

mvn install:install-file -Dfile=~/Downloads/dropbox-java-sdk-1.5.1/lib/dropbox-java-sdk-1.5.1.jar -DgroupId=com.dropbox -DartifactId=dropbox-java-sdk -Dversion=1.5.1 -Dpackaging=jar

This approach is a nuisance if you are working with a team, or you develop on multiple machines.

Docs on the install:install-file goal:

Tuesday, August 9, 2011

Salesforce needs to copy Google's Spreadsheets for their Views.

Salesforce's views functionality is painfully outdated by todays standards, and is frankly embarrassing if you compare it along side the likes of what Google Docs or Office 365 can offer.

Some examples

  • You can't sub-sort on a column
  • You have a filter bar, but it only works one level, and you can sort after you filter
  • Re-sizing of columns is possible, but not sticky, you need to re-size them every time!
  • Sorting forces a refresh of the data, it could be done client side
  • You can only view 200 records at once.
  • You can display only 15 columns on one view

Lets compare this to the Google Docs spreadsheet offering.

  • Real filter tools, just like excel
  • Sub sorting works
  • Filtering combined with sorting works DING!
  • Sorting/filtering all happens on the client side, it's fast
  • Display up to 5000 records on one screen, and the UI is still fast
As most know, we can do a lot more in the browser today, with blindingly fast java script engines, rich libraries, hell, even local storage. Lets hope salesforce will do a refresh on one of the staple features of their product. Wizbang Jigsaw, Radian6, Chatter etc.. That's all great, but don't forget about these basics please!

Here are some posts on the idea exchange that already cover most of what I have pointed out. Please up vote these!

Friday, August 5, 2011

Using static resources with Salesforce custom Javascript buttons

Having hacked around with Salesforce's custom button that execute javascript, I quickly found myself needing to reuse code across other buttons within our CRM.

Salesforce has a Static Resources repository where you can store images, java script, even zip and jar files. Accessing said resources from the likes of Visualforce pages is a breeze;

Unfortunately, the $Resource variable has not been made available for use in custom buttons. However, we don't really need that variable to get a static resource into our Custom Button. All static resources are accessible via the URL in your salesforce org.

If you navigate to the Static Resources in your salesforce org, and click on the View File link;
You will see that the resource is accessible by a link as follows; https://yourorg.my.salesforce.com/resource/1312307963000/jbUtils

You could include this file directly into your custom button as follows:
but the maintainability of this approach will be extremely poor. If you play around with the URL a little more, you will find that the static resource is also available if you remove the string of digits, like this:
however, this also will cause problems.

See Salesforce does a lot of caching in order to allow their systems to scale. The long string of digits is a cache buster. Every time you update your static resource in Salesforce, a new string of digits will be generated. In fact, the string they use is actually the date & time that you created or updated your static resource represented in Unix Epoch Time and padded out with three trailing zeros.

The $Resources variable takes care of all this magic for us, when used in Visualforce pages, but as it is left out from custom buttons, we need to get creative!

This task would be especially simple if we had some useful time/date functions as part of the Salesforce validation functions, but no such luck. One may think that we could use Javascript date/time functions, but not so fast! The {!REQUIRESCRIPT()} syntax is pre-processed by salesforce, long before it touches your browsers javascript engine.

So, we are left with creating a MacGyver-esque cash buster with the tools that we have. The static resources urls expect to receive a string 17 digits. No letters, hyphens or colons. The closest we can come to is NOW() which will give you a string that looks something like this: '2011-08-06 01:42:00Z' If we strip away the non numeric characters, we get this 20110806014200 which is 14 characters in length. Recall that the URLs expect 17 characters. Using the Salesforce substitution functions, we can create a valid cash buster. Behold the following monstrosity;

{!REQUIRESCRIPT('/resource/' & LEFT(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(TEXT(NOW()),':',''),'-',''),' ',''),10) & '000/jbUtils')}

Now, every time a user visits the page with your custom button, because NOW() always is a new, numerically larger string, the user will always get the freshest-cache-busted static resource available, and you are fee to reuse javascript code in all of your custom salesforce buttons!

Some words of warning; This is a hack, and if this method was to upset our kind Salesforce overlords, we could find the method breaking in the night. Hopefully, said overlords will find our cache-busting-ingenuity charming & cutesy, and reward us by giving us $Resources for our lowly custom buttons...

Monday, March 7, 2011

Hey Salesforce, Is "DE LOGIN" a new synonym for Logout, or a German login page?

The authentication methods to post to the plethora of salesforce community resources is a nightmare. Many times I have abandoned replying to a forum question, or adding a comment to an Idea posted in the Ideas exchange.

This morning, I was trying to reply to a post about a bug in version 21.0 of the Apex Data Loader on the http://forums.crmsuccess.com forums. I dutifully click Reply, and I'm prompted to login, which I do, and it appears to have succeed. Except, I don't see the reply text-area I expect, in fact, I don't see the same forums at all. I'm not even on the same damn forum any more. The salesforce authentication page has shipped me off to the http://boards.developerforce.com Force.com Discussion Boards!!?

I navigate back to the post on the http://forums.crmsuccess.com to reply, but I'm still not authenticated, I try again, and same thing, I end up authenticated on developer-force. I scratch my head, thinking what I have done wrong, because this must just be a case of me being dumb on a Monday morning. I look around, and I spot this gem:
What a odd way to display a "Logout" button? Or.. is this a login portal exclusively for Germans? How curious?

I click on that DE LOGIN button, get prompted for my credentials, which I enter, and click "Login" and where do I end up? In my production Salesforce Org.

To the person at Salesforce who had the bright idea to create a login button, on a forum, that is supposed to be an abbreviation of "Developer Edition Login" that logs me into my Salesforce org. You sir, are an idiot.

Friday, December 31, 2010

Salesforce acquires Etacts - about time.

I'm happy to see that salesforce acquired Etacts, because, I hope, it means that Salesforce should be refreshing its support & integration with Google Apps. Etacts has a browser plugin for Firefox and Google Chrome, which adds functionality to the gmail web interface.

Salesforce has always been good about bridging the gap between enterprise messaging apps, for example, Outlook and Lotus Notes. That strategy is crucial in providing a path to enterprise users into the SFDC cloud eco-system. It's well over due that Salesforce pays proper credence to integration with other Cloud players, such as Gmail/Apps. The balance is tipping from on-prem to in-cloud, which doesn't make their Outlook/Notes connectors irrelevant by any stretch of the imagination, but they have to better embrace their neighbouring cloud peers. I hope, this latest purchase is just that.

I'm curious if gmail has a set interface to allow for this integration, or if the Etacts plug in lives and dies by the Gmail upgrade cycle. I imagine the Etacts plugin model works similar to any old grease monkey script. I'm hoping that this little plug in will be retrofitted to work with Salesforce allowing users to display some Contact/Account info directly in gmail, as well as pushing emails into their SFDC org and associating said emails with Contacts/Ops/Cases/Custom objects.

Lets just hope the Salesforce/Etacts team can retrofit and roll this out in short order. I'm hoping they do some pilots, so us plebeians can get some hands on early on.


I have found the GMail gadgets API here: http://code.google.com/apis/gmail/gadgets/ which is what Etacts must be using. It's the same API that tools like Rapportive also use. Rapportive is a similar product to Etacts, but it does not support Salesforce.com, despit seeing some comments from last year stating that they would support Salesforce.com in the future.

The Coroners Toolkit from ten years past.

I randomly found something I wrote ten years ago now; "An Introduction to The Coroners Toolkit". Fun for me, probably not so fun for any readers here.

The TCT project, authored by Wietse Venema, still appears to be semi-alive here.

Wednesday, December 15, 2010

ETL - Pentaho and Salesforce.com

I'm blown away every time that I use Kettle, especially with Salesforce.

The power and utility of this ETL tool is just brilliant, and the pain threshold to get running with this tool is actually really low.

I have been working on migrating my companies contract records off the Salesforce standard Contract record and over to the newer "Service Contract" object which supports the use of product line items.

The data I'm dealing with is not well structured. We have 30+ custom fields on the Contract object, typically service quantity and service price pairs, and some extra fields that all relate together in non-obvious ways. The idea is to do move to Service Contracts, and use product line items to quantify what services a client is entitled to, the price and the quantity.

The mapping of this is non-trivial, and one of those things that if you don't automate, you will have to scrap your work several times and start over.

The Kettle ETL tool let me create one bog ugly transformation, and re-peat the job again and again until I had incrementally built the whole thing out, and iron the bugs out.

I also use this same tool extract data from various source in the business, correlate and load (insert/update) those records into Salesforce.

Every time I mention ETL in the context of salesforce, people instantly say "Oh, so your using Informatica?". I have never used Informatica, and I know nothing about it, I have little interest in even looking because Kettle is one of the most solid items in my data toolkit, and it's free!

Unfortunately, Pentaho's other reporting tools do not seem to meet the same standard as Kettle has set.

If your doing ETL, and especially if it involves Salesforce, go check this out; http://kettle.pentaho.com/ Also known as PDI - Pentaho Data Integration

#Edit; fixed typos.