Tag Archives: Salesforce

Dreamforce 2016: The Dark Art of CPU Benchmarking

FINALLY! Salesforce has released many of the Dreamforce 2016 sessions on YouTube.

I had the great privilege of working with Bobby at NimbleUser for a few years and was eagerly awaiting for this session to become available. It did not disappoint.

In this session, Bobby and Dan Appleman discuss how to benchmark how long a particular operation takes in terms of CPU usage, their findings with benchmarking various things and their recommendations about what to do in these situations, and the tradeoffs and considerations to keep in mind.

Benchmarking Highlights

  • Single assignment takes .035 microseconds. actId = sourceId;
  • Static field assignment takes .58 microseconds.
    • actId = ct.AccountId;
  • Dynamic Field Assignment take 18 microseconds. actId = ct.get(‘AccountId’); so assign this to a temporary variable first and then use the temporary variable.
  • The foreach loop is slower than using a traditional for loop like “for (Integer i = 0; i < count; i++) {}”. The foreach loop takes around 4 microseconds for simple assignment versus 0.75 microseconds with a traditional for loop. This is inline with my profiling results where a traditional for loop is roughly 4 times faster than the for each loop.
  • Validation Rule formula functions take roughly 30 milliseconds per invocation.
  • Workflow rules are more efficient than process builder equivalents.


The above results may change over time as Salesforce changes their software, hardware, and other factors. These findings are based on their results using Summer 16 with the orgs they used. Your mileage may vary.

Other Nuggets

  • SearchTheForce is a website they created that uses Google to search the common Salesforce sites for keywords your looking for.
  • The code used in the benchmarking can be found at the DF16-Benchmarking GitHub repository.

Thank you Bobby and Dan for a great session!

What did you think of the session? What other sessions would you recommend?

Taking The Freelance Plunge

One of my dreams has always been to start my own business. Now, I’m taking the plunge and starting with freelance Salesforce consulting work. If you’re interested in hiring me, please contact me on LinkedIn.

Writing those words evoked feelings of excitement, dread, and relief. Excitement for new challenges, new opportunities, expanding my professional reach, and other things. Dread for what if I fail, how will I get clients, and other uncertainties. Relief since I’ve been confiding this in friends, family, and colleagues even though I’ve wanted to share this publicly for months and now I am.

Next Steps

  • Incorporate. My plan is to incorporate as an S-Corp mainly for the Self-Employment Tax benefits despite the additional overhead compared to an LLC at first. Long term, if the business grows and outside investment is needed, it’s easier to get investors.
  • Clients. Grow the customer base.
  • New Equipment. Get new equipment such as a laptop and chair, since I’ll be working from home.
  • Website Enhancements. My company name will be Metillium and this website will serve as the company website and a blog. This will be done over the coming months.

Thank You

  • Amanda, my wife, for being so supportive, helping me realize I can do this, and bouncing so many ideas off of you. Also, for the kick in the pants to stop talking about it and “Do It!”. Love you!
  • NimbleUser for being a great place to work. The collaborative, high-quality work, excellent employees, and mentors have helped me grow tremendously in various ways in the last 5 years.
  • My other colleagues, mentors, professors, and others that have helped me over the years.

How did you take your plunge? What emotions were felt? Any advice for someone starting out?

Salesforce Javascript Buttons

Javascript buttons are buttons that are shown on a record that execute the configured Javascript when clicked. In this post, I’ll cover benefits and drawbacks. For how to configure one, see Create a Custom Button in Salesforce and other resources.


  • Fast Development. Enter the javascript to run, click the button, verify functionality, repeat until working as designed.
  • Can execute web services. One can create a Salesforce web service in Apex that can then be invoked from a record. This is useful for doing various processing on a record. For example, the candidate has been approved and now you want to update the status and email the individual in one button click.


  • UX Experience calling web services. If the web service does a moderate level of processing, the user may have to wait seconds for the operation to complete. Salesforce doesn’t automatically update the UI to indicate that something is happening. It’s up to the developer to update the UI to reflect the processing is in-progress and to notify the user with a message of the operation’s success or failure.
  • Have to add dependent libraries like JQuery through RequireScript syntax or other means. Open jQuery Dialog from Custom Button for more info.
  • Cross-Browser Compatibility.  While ubiquitous  across browsers, Javascript feature support still varies so ensure that your code works in the Salesforce supported browsers like Chrome, Firefox, and Edge. ECMAScript 6 Compatibility has a nice matrix showing the capabilities of browsers as of April 2016.

Overall, Javascript buttons are sweet. They are good for light to moderately complex operations. For more complex ones, use a Visualforce or Lightning page to handle it.

What do you think of Javascript buttons? What other benefits and drawback would you consider? Also, how often do you use them?

Happy Coding,


Salesforce Bulk API Starter Nuget Installation Issue

danieleboldrini reported the following issue when trying to install the SFBulkAPIStarter Nuget package in VisualStudio 2015. Full Issue Details

Could not install package ‘SFBulkAPIStarter 0.12.0’. You are trying to install this package into a project that targets

‘.NETFramework,Version=v4.5.2’, but the package does not contain any assembly references or content files that are compatible with that framework.

With VisualStudio 2015 Community, I was able to reproduce the issue in a new console application. Doing the same in VisualStudio 2013 Community installed fine. Very weird.

After digging around a bit, Microsoft changed how they treat Nuget package lib contents in VisualStudio 2015. In version 0.12, all the DLLs were under the lib folder because they weren’t targeting any specific version of the .NET runtime since there wasn’t a specific version dependency.

To appease the VisualStudio 2015 gods, the DLLs were put under the net45 folder in the Libs folder and released in version 0.13 on Nuget.

What Nuget packaging issues have you encountered? Is there a better way to handle this?


Helpful Salesforce Addons & Tools

Here are Salesforce Addons & Tools that I use. If you use others, please share in the comments.

Declarative Lookup Rollup Summary – This is an open source Salesforce managed package that lets one declaritively define a rollup-summary on a lookup or master-detail. It aggregates a value from child records onto a parent record using the configuration defined. This was originally developed by Andy Fawcett and now has many contributors.

Metadata API Apex Wrapper – This Salesforce managed package lets one call the Salesforce Metadata API from Salesforce using Apex. By allowing creating, updating, or deleting metadata programmatically, this opens up more declarative possibilities from Salesforce natively. For example, creating triggers and apex classes from Visualforce and Lightning pages or automating the install or uninstall of packages.

Workbench – A website hosted by Salesforce that has various utilities for admins and developers. Examples include a SOQL query builder, REST explorer, Schema browser, and bulk data exporter and importer.

Salesforce Boostr – :rocket: Boostr Chrome extension for Salesforce.com. Started by mattsimonis in February, 2016, this extension provides various useful enhancements to the Salesforce UI when logged in. Examples include clearing out the text in the Admin Search’s textbox and showing the number of fields selected on the field history tracking page. Salesforce Boostr Chrome Extension Link

Happy Coding,