Tuesday, 5 January 2016

@ReadOnly


 
  @ReadOnly
 

  •  Because of Limitations like 'Maximum no.of items in a collection that can be iterated is 1000' or 'generally query in VF should not go beyong 50,000 rows'.  It was not possible to show millions of records on VF page.                                                                                                     But thanks to @ReadOnly annotation in API version 23.0 now we can !
  • Only available for Web services and the Schedulable interface.
  • Used for methods.
  • Allows you to perform unrestricted queries against the Force.com database.  All other limits still apply.
  • To use the @ReadOnly annotation, the top level request must be in the schedule execution or the Web service invocation. 
   For example, if a Visualforce page calls a Web service that contains the @ReadOnly annotation, the request fails because Visualforce is the top level request, not the Web service.


  • ReadOnly mode restricts you from DML Operations, calls to System.Schedule, Sending an emails, calls to @Future annoted methods.
  • @ ReadOnly methods should also have @Remote action annotation and either global/public or static access specifiers.
  • Visualforce controller methods with the @ReadOnly annotation automatically take advantage of read-only mode and help us to retrieve a larger collection of records.
  • Very helpful and handy in a visualforce controller for building super custom reports.


  More : 
  https://success.salesforce.com/ideaView?id=08730000000kourAAA

No comments:

Post a Comment