Monday, October 3, 2011

New Release Winter 12 In Apex Salesforce

Hello folks,
We have some new important features in Winter 12 Release.

1. Read Only Mode :
By default, Visualforce pages have a limit of 50,000 records that can be queried in a single request, and iteration components such as <apex:pageBlockTable> are limited to 1,000 iterations. For pages that do not need to modify data, you can now enable read-only mode for the page, using the new readOnly attribute :

<apex:page controller="SummaryStatsController" readOnly="true">
      <p>Here is a statistic: {!veryLargeSummaryStat}</p>
</apex:page>
Setting a page to read-only mode relaxes the query limit to 1 million rows, allowing you to work with much large of data. It also expands the iteration limit to 10,000 iterations.

2. label attribute for input components :

Support for overriding the default form field label has been added to <apex:inputField>. With this change, all form input components support this attribute.

3. tabOrderHint attribute for <apex:inputField>

Another change for <apex:inputField> is the addition of the tabOrderHint attribute. This attribute lets you
specify the relative order of form fields on a page, for the purposes of tabbing through the form. It does not allow youto specify the actual value of a field's tabIndex HTML attribute. Instead, Visualforce uses the tabOrderHint to calculate an appropriate HTML tabIndex for the field.

tabOrderHint is not supported inside iteration components like <apex:pageBlockTable> or <apex:dataList>.
tabOrderHint is not currently available for input components other than <apex:inputField>. Other input
components like <apex:inputText> can use the tabIndex attribute instead.

4. Package Install Improvements : New IsTest(OnInstall=true) Annotation

Using the IsTest(OnInstall=true) annotation, you can control which Apex tests are executed during package installation. This annotation is used for tests in managed or unmanaged packages. Test methods with this annotation, or methods that are part of a test class that has this annotation, will always be executed during package installation. Tests annotated to run duringpackage installation must pass in order for the package installation to succeed. It is no longer possible to bypass a failing test. during package installation. A test method or a class that doesn't have this annotation, or that is annotated with isTest(OnInstall=false) or isTest, won't be executed during installation.
This annotation applies only to packages uploaded in Winter '12 or later. Packages uploaded prior to Winter '12 aren't yet affected by this annotation and all their tests run during installation.

Note: Starting with Spring '12, tests won't automatically run when a customer installs your package. If you want to run tests upon package installation, we strongly recommend that you add the @isTest(OnInstall=true)
annotation to all test classes or test methods that you want executed, and subsequently, package and release a new version of your app before Spring '12.

5.Visualforce Charting—Pilot :

The Winter '12 release has a new pilot feature, Visualforce Charting. Visualforce charting is a collection of components that provide a simple and intuitive way to create charts in your Visualforce pages and custom components. Visualforce charting gives you an easy way to create customized business charts, based on data sets that you can create directly from SOQL queries, or by building the data set in your own Apex code. By combining and configuring individual data series, you can compose charts that display your data in ways meaningful to your organization.


Charts are defined using Visualforce components, which generate JavaScript that renders the chart within the browser. Here's what a simple chart might look like:
<apex:page controller="PieChartCtlr" title="Pie Chart">
        <apex:chart data="{!pieData}">
             <apex:pieSeries labelField="name" dataField="data1"/>
         </apex:chart>
</apex:page>
Note : Contact salesforce.com to have Visualforce charting enabled for your organization.

6. New Sites Methods
The following new methods have been added to the Sites class:

• getAdminEmail: Returns the email address of the site administrator.
• getAdminId: Returns the user ID of the site administrator.

Additionally, createPortalUser now has an additional optional argument of type Boolean, which determines whether a new user email is sent to the portal user.

7.New System Methods: isBatch, isFuture, and isScheduled
The following methods have been added to the System class:
• isBatch: Determines if the currently executing code is invoked by a batch Apex job. Since a future method can't be invoked from a batch Apex job, use this method to check if the currently executing code is a batch Apex job before you invoke a future method.

• isFuture: Determines if the currently executing code is invoked by code contained in a method annotated with @future. Since a future method can't be invoked from another future method, use this method to check if the current code is executing within the context of a future method before you invoke a future method.

• isScheduled: Determines if the currently executing code is invoked by a scheduled Apex job


8.Common Test Data Creation Methods in Public Test Classes.

Classes annotated with @isTest no longer have to be private. You can now create public test classes that expose common methods for test data creation. These public methods can be called by tests outside the test class for setting up data that the tests need to run against.

Methods of a public test class can only be called from a running test, that is, a test method or code invoked by a test method, and can't be called by a non-test request.
This is an example of a public test class that contains utility methods for test data creation:

@isTest
public class TestUtil {
public static void createTestAccounts() {
// Create some test accounts
}
public static void createTestContacts() {
// Create some test contacts
}
}


9. Higher Governor Limits in Some Categories
The following governor limits are higher for Batch Apex and future methods:
• Total number of SOQL queries issued is 200 instead of 100.
• Total number of executed code statements is 1,000,000 instead of 200,000.
In addition, the heap size limit is now doubled and is raised for Batch Apex and future methods
• Total heap size is 6 MB.
• Total heap size for Batch Apex and future methods is 12 MB.

10.Method Size Limit

The size of a method is limited to 65,535 bytecode instructions in compiled form. Large methods that exceed the allowed limit cause an exception to be thrown during the execution of your code.


11. New Schema Methods
The following new method has been added to the Schema.ChildRelationship class:
• isRestrictedDelete: Returns true if the parent object can't be deleted because it is referenced by a child object, false otherwise. This prevents users from deleting any records that are part of a lookup relationship.
The following new methods have been added to the Schema.DescribeFieldResult class

• isCascadeDelete: Returns true if the child object is deleted when the parent object is deleted, false otherwise. This allows a cascade delete when a parent lookup record is deleted, allowing users to delete large numbers of records without regard for sharing or visibility constraints.

• isRestrictedDelete: Returns true if the parent object can't be deleted because it is referenced by a child object, false otherwise. This prevents users from deleting any records that are part of a lookup relationship.


12. Getting the Currency Code for Single Currency Organizations

The UserInfo getDefaultCurrency method now returns the organization's currency code for single currency
organizations.

For Apex saved using Salesforce API version 22.0 or earlier, getDefaultCurrency returns null for single currency organizations.

13. String Conversion of Number Fields

Previously, when String.valueOf was called with a field of type Number of an sObject, it incorrectly treated the number field as a Decimal when converting it to a String and used the String.valueOf(Decimal d) method to perform the conversion to a String. Apex now correctly converts a number field to a Double before performing the conversion and uses the corresponding String.valueOf(Double d) method to convert the Double value to a String. One side effect of this change is that converted String values of number fields that have no decimal fraction now have a decimal point (.0) in them where they didn't before.


14. Fix for Uncaught Exception Bug for Apex Code Saved Using Salesforce API version 20.0 or earlier

Exceptions were not being caught in the catch block under a certain condition for Apex code saved using Salesforce API version 20.0 or earlier. The exception wasn’t being caught in the catch block if the try block also threw an exception. This bug has now been fixed for all versions of Apex.



Cheers................











3 comments:

  1. Very Valuable Information..Thanks Vijay

    ReplyDelete
  2. Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as
    kajal agarwal hot

    ReplyDelete