Are you hopelessly sucked into Freemium games like I am?

I made an Android game. It sucks. It’s got everything I love/hate about Freemium games.

Check it out: Freemium in the Google Play Store.

Comments Off

Speaking at Dreamforce 2016: Creating Admin Configurable Apps

I’m presenting at Dreamforce 2016! My session is called Creating Admin Configurable Apps, it’s being held
Tuesday, October 4, 2016 from 12:00 PM – 12:40 PM at Moscone West, 2004

Here’s the slide deck:

Hope to see you there!

Comments Off

Whitelist All IPs for Salesforce Chrome Extension

So it’s been awhile since Enable All Trusted IP Ranges for a Salesforce Org actually worked, because Salesforce disabled the ability for homepage components to run javascript around Summer, 2015.

There was a workaround logged as a Github issue which simply ran the javascript from the homepage component in the developer console, and that seemed to work, I referred people there. It wasn’t really elegant, but it worked.

I’ve had it on my plate to create a browser extension to perform this capability ever since. A few days ago, I was going to manually add an IP to Setup => Security Controls => Network Access, and I saw a button called “Allow All Ranges (!)”. I clicked it, and sure enough, it actually added all IP ranges! I looked through all of my installed Chrome extensions, and didn’t see any of them that advertised this feature. I disabled them one-by-one until I found the culprit: Apex Debugger by motiko. Browsing the source, motiko attributed my original post for that piece. I asked motiko about it in email, asked for permission to publish this feature standalone, and he agreed.

So I spent a couple hours, stripped out everything but this feature, packaged it up, paid the $5 registration fee, and put it on the Chrome Web store:

Here’s a quick video on how it works:

Please let me know if you have any questions via twitter. Cheers!

Oh, and the source is on github.

Comments Off

Apex: Booleans can be null

Apex on Salesforce is a subset of Java. In general a Java developer should feel right at home when creating Apex.

One of the things I encountered recently where Java and Apex differ is the ability to access Primitives. For example, Java has a boolean type, which can be true or false. Additionally, there’s a Boolean type, which can be true, false, or null, and can be used in Collections because it inherits from Object. If using the latter, the consumer need always check for null before checking true or false.

Apex does not have access to Primitive Data Types, only those which inherit from Object. Therefore this issue can result:

Boolean isError;
if (isError) {

This will fail with:

System.NullPointerException: Attempt to de-reference a null object

Unless you instantiated the Boolean to a true/false, you must check for null before checking whether it’s true or false. Alternatively, you can explicitly check for true (which feels wrong, but would circumvent the issue):

Boolean isError;
if (isError == true) {

No issue results.

I saw this recently when I queried a Checkbox field on an object. I created the Checkbox field AFTER the record was created, so each of the existing records default the Checkbox (Boolean) field to null, instead of false as you might expect.

In summary:
The Best Practice for dealing with Booleans in Apex is to explicitly check for == true/false

if (Boolean == true)

rather than use the shorthand.

if (Boolean)

Hat tip to Jeegar Brahmakshatriya for the help.

Tagged | Comments Off

Importing a java keystore jks file to Salesforce

I had a certificate which needed import into Salesforce, and one of the options provided to me was to put it into a java keystore, which could easily be imported. Since the file I had available to me wasn’t in the keystore format, I had to figure out how to import it into a keystore on my Mac using the keytool library. I had a pfx file to me, but the same principle can be applied to a .cer file as well.

Here are the commands using java’s keytool to perform this:

keytool -importkeystore -srckeystore {pfxfile} -srcstoretype pkcs12 -keystore keystore.jks

This prompted me for the passwords, and generated a keystore.jks file.

The key was imported into the keystore with the alias “le-9c090e06-14af-4ddd-b5fe-6ac9af45ea18″, which has an unacceptable format:

Error: Keystore contains an entry whose alias is not acceptable for import

Thanks to the Salesforce help, it was a quick and easy keytool command to rename it:

keytool -keystore keystore.jks -changealias -alias le-9c090e06-14af-4ddd-b5fe-6ac9af45ea18 -destalias {compliant_name}

I was then able to import the jks file into Salesforce via Setup => Security and Controls => Certificate and Key Management => Import from Keystore.

Tagged , , | Comments Off

Endpoint for Salesforce custom SOAP web service

It was surprising difficult to figure out what the endpoint should be for a custom SOAP web service created on Salesforce, probably due to the generic terms used.

When you create a custom soap web service in Salesforce, e.g.

and you want to figure out that URL to call it, you need simply do the following.

  1. Go to your class in Salesforce, Setup => Develop => Apex Classes => WebserviceExample (in my sample)
  2. Click the “Generate WSDL” button
  3. Look toward the bottom for the service element, and find the port’s soap:address element, and there it is! As of v32.0 it’s of the format: https://{node}{classname}

Here’s the portion of the WSDL you should find:

If you attempt to call your custom web service methods using the Partner WSDL, Enterprise WSDL, Apex, Metadata, etc. etc. you will presented with this error:

No operation available for request …

Tagged , , , | Comments Off