My Favorite Top 10 Features of Winter 13 release – Salesforce

Dear Friends, I am very excited to write this article about the cool Winter 13 features which i have added in My List. There are lots of lots of new features added in this release and i have made the list of my top 10 favorite features. Yesterday Salesforce published its Winter 13 release notes at /help/doc /en/salesforce winter13release notes.pdf.

Salesforce Winter 13 Release Notes
Salesforce Winter 13 Features

You can also sign up for free pre-Release Winter 13 Organization at /form/signup/ prerelease- winter13.jsp

So, here my Favorite Features:

1. Enhancements in Developer Console

a. Test Tool :

The Winter 13 release adds a Tests tool to the Developer Console. Use the Tests tool to run Apex unit tests on the server and check your code coverage. Now you can edit, debug, and test your applications without leaving the Developer Console.

b. Query Editor :

The Winter 13 release adds a Query Editor tool to the Developer Console. Use the Query Editor tool to query data from your organization. For example, while developing Apex code, write a SOQL query and verify that the results are what you expect. Edit and execute the query until you have the data you want. Then use the query in your code.

2. Polymorphic SOQL

SOQL Polymorphism lets you select different sets of fields in your SOQL queries, depending on the object type of a polymorphic relationship field. For example, the What field in an Event record could reference an Account, Opportunity, or Campaign. You can now specify different fields to select based on the referenced object type using the TYPEOF clause. The following example specifies different fields for each of the possible object types:

		WHEN Account THEN Phone, NumberOfEmployees
		WHEN Opportunity THEN Amount, CloseDate
		WHEN Campaign THEN ExpectedRevenue, StartDate
		ELSE Name
FROM Event

If the object type referenced by Event. What is an Account, the query returns the referenced Account’s Phone and NumberOfEmployees fields. If the object type is an Opportunity, the query returns the referenced Opportunity’s Amount and CloseDate fields. If the object type is a Campaign, the query returns the referenced Campaign’s ExpectedRevenue and StartDate fields. Finally, if the object type is any other type, the Name field is returned.

3. Non-Primitive Types in Map Keys and Sets **

This is my favorite feature and i was missing it badly from core Java. Now we can have non – primitive datatype i.e. Objects as a key in Map and Sets. And like Java we will need to implement / Override equals() and hashcode() method to make it workable.

4. Support for Testing Callouts

And now the waiting for capability of testing callouts in Apex test class is over. I am sure that most of the developers caught in situation where they need to test the Apex callouts and came to know that Apex does not support it directly.

Apex now provides the ability to test callouts. The native support for handling callouts made in test context and generating artificial responses increases your code coverage by tests and simplifies the testing process. You no longer need to modify auto-generated code of an external SOAP Web service, or add extra logic for callouts made via the HTTP classes. The new Test.setMock method instructs the Apex runtime to handle callouts in test methods and to generate a mock response that you specify.

Testing HTTP Callouts by Implementing the HttpCalloutMock Interface

Provide an implementation for the HttpCalloutMock interface to specify the response sent in the respond method, which the Apex runtime calls to send a response for a callout.

global class YourHttpCalloutMockImpl implements HttpCalloutMock {
global HTTPResponse respond(HTTPRequest req) {
// Create a fake response.
// Set response values, and
// return response.

We can also Test the Http Callouts using Static Resources using one of the inbuilt classes StaticResourceCalloutMock or MultiStaticResourceCalloutMock.

I will explain this feature in my coming post in more detail.

5. Testing Web Service Callouts

As in Winter 13 Salesforce provided ability to test Http Callouts, we have ability to test the Web Service Callouts also.

By default, test methods don’t support Web service callouts and tests that perform Web service callouts are skipped. To prevent tests from being skipped and to increase code coverage, Apex provides the built-in WebServiceMock interface and the Test.setMock method that you can use to receive fake responses in a test method.

6. New ID.getSObjectType Method

The new getSObjectType method on the ID type enables you to obtain the sObject token that corresponds to the sObject of the ID. This is particularly helpful when you don’t have access to the sObject itself, for example, in future methods that don’t accept sObject types as their parameters, and therefore you can’t call getSObjectType on the sObject. Also, with this new method, you don’t have to perform a global describe call to obtain an sObject token for a specific sObject name. You can simply call getSObjectType on the ID. In this way, you also avoid reaching the describe governor limits.

7. Loading Test Data from Static Resources **

Using the new Test.loadData method, you can populate data in your test methods without having to write many lines of code. Simply, add the data in a .csv file, create a static resource for this file, and then call Test.loadData within your test method by passing it the sObject type token and the static resource name. For example, for Account records and a static resource name of myResource, make the following call:

List<sObject> ls = Test.loadData(Account.sObjectType, 'myResource');

The Test.loadData method returns a list of sObjects that correspond to each record inserted.

8. Global Interface Method Implementations No Longer Need to Be Global

When you implement methods of a global interface, you can declare those methods as public or global in your class. You’re no longer required to declare them as global. This gives you a choice of how much visibility you would like your method implementations to have. If you’re a package developer, you can include an interface implementation in a package and make it inaccessible to the subscriber’s org by declaring the class and methods as public. For example, the package can include a public batch implementation class with public methods that isn’t visible to the subscriber.

This also applies to overriding global class methods. The methods overriding global methods can be declared as public or global.

9. JSON Support for Additional Built-In Types

JSON serialization and deserialization support has been added to additional built-in Apex types. These types are the return types of Database methods, namely:

  • DeleteResult
  • EmptyRecycleBinResult
  • LeadConvertResult
  • SaveResult
  • UndeleteResult
  • UpsertResult

In addition to these supported types, JSON continues to be supported as previously for sObjects (standard objects and custom objects), Apex primitive and collection types, and instances of your Apex classes.

10. Map Attributes for Custom Components
It’s now possible to assign maps to attributes of custom components. Declare the map attribute like this:

<!-- Attribute definitions -->
<apex:attribute name="items" description="A map of items to be listed."
type="map" required="true"/>
<!-- Component implementation -->
<apex:repeat value="{!items}" var="itemKey">
<li><strong>{!itemKey}</strong> {!items[itemKey]}</li>

You don’t need to declare the specific data types for the map collection contents, it will be determined at runtime.

There are many more enhancements and new features added in Winter 13. Stay tuned for more articles on same release.
Happy Coding !!!




Related Posts


4 responses to “My Favorite Top 10 Features of Winter 13 release – Salesforce”

  1. Vishal Avatar


    I have never seen so many exciting features in any single release so far!

    Thanks for the wonderful update on this 🙂

  2. Ashish Avatar

    thanks sir….

  3. Chandra Ch Avatar

    Hi Shiva thanks for updations and knowledge sharing

  4. Mohammed Sohail Avatar
    Mohammed Sohail

    Thank you Sir

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from Jitendra Zaa

Subscribe now to keep reading and get access to the full archive.

Continue Reading