Summer '16 Highlights for ISV Developers

The Summer '16 release is upon us and for there's a couple of things in there that appear small but could have some serious, positive impacts on your life as a developer. As usual the release notes are pretty lengthy and I encourage you to check them out and get acquainted with the parts relevant to you (read them all if you want, but you might want to crack open a beer/wine).

The Salesforce Summer '16 Logo

X-ray Goggles for Managed Packages

Unless you work at an ISV partner, or do a lot of work with managed packages you may not know that you can actually interact with Apex classes in a managed package if they have global scope. To be concise, what I mean by 'interact' is that you can call any global methods within that class and access any globally defined member variables.

The only issue with this is that you can't see the source code of a managed package meaning you have to reply on documentation (if any) made available by the package provider. Even ISV partners can't see their own code in a client's org when logged in through the support channel.

/*  
This file is generated and isn't the actual source code for this  
managed global class.  
This read-only file shows the class's global constructors,  
methods, variables, and properties.  
To enable code to compile, all methods return null.  
*/
global class MyClass {  
    global Decimal myDec;
    global String myString {
        get;
        set;
    }
    global MyClass() {
    }
    global Integer myMethod(Integer arg1) {
        return null;
    }
}

Summer '16 is bringing a change that will let you see the the 'skeleton' of the class, in other words, all of it's global methods and member variables that you can work with. As you can see from the example above that I've borrowed (I'll give it back!) from the release notes you don't get to see the actual code, but a generated snippet that shows you what's there without revealing any implementation details or specifics.

FORMAT() FTW

This gets a tiny amount of real estate in the release notes, yet it's going to make many developers very happy indeed. Since it's such a short snippet, I'll quote the release notes entirely:

Use FORMAT() with FIND to apply localized formatting to standard and custom number, date, time, and currency fields. For example:

FIND {Acme} RETURNING Account(Id, LastModifiedDate, FORMAT(LastModifiedDate) FormattedDate)

The sharp-eyed reader will note that this is for SOSL, but what about SOQL? Well that actually came in Spring '16, so it's already available. I meant to write about it at the time but entirely failed to do so which is why I included it here.

There's many an occasion where you need to display dates, times, numbers and currencies in a localised format but unless you can use <apex:outputField> you have to do it yourself. FORMAT() is a SOQL and SOSL function that can save you effort, pain and lines of code.

In my developer org, the query [SELECT FORMAT(CreatedDate), FORMAT(Amount) FROM Opportunity limit 1] gives '16/12/2011 9:58 AM' for the CreatedDate field and '$60,000.00' for the Amount field. This will be a huge time saver.

There's Gold In Those Pages

There's plenty of other updates coming in the next release that will make a Salesforce developer happy. There's a new SObject method called getPopulatedFieldsAsMap() which does exactly what you'd expect, and there's a related change to the serialize method which allos you to suppress null values in it's JSON output.

Make your future-self happy and save them some time by setting some aside now to read the release notes.

comments powered by Disqus