+ Start a Discussion
vickySFDCvickySFDC 

what is main use of @Readonly and @Remoteaction?Which scenario we will use this annotations?

Hi All,

 

Use of @ Readonly and @ Remote action?

Which situation we can use the @ Read only annotation?

what is diff between Visualforce page read only mode option and @ Readonly annotation?Is there any performance things involved?

Some times both Annotation (Readonly,Remoteaction) use in the Apex code?what is the benefit  for using this?

 

pls help me  on this ......

 

 

Thanks,

 

Vicky

 

 

 

 

 

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

Action function relies on a full postback, so that will maintain state between requests.  JavaScript remoting is a stateless and simply executes a request based on the parameters.  Remoting is way faster as the viewstate doesn't have to be deserialized from the form posted back and all the property setters executed.

All Answers

bob_buzzardbob_buzzard

You'd use the readonly annotation if you have a large amount of records to process - it removes the 50,000 record limit that usually applies to a transaction. This does mean that you can't write back to the database though.

 

Remote action means that a Visualforce page can access the method directly from JavaScript, using JavaScript remoting.  You'd use this if you didn't want to use form posts to carry out actions.  Remote action methods are stateless, so the request needs to carry all the information required to process it.

vickySFDCvickySFDC
Thanks for reply...

When we can go for Remote action?can you give some examples?In apex action function also call Javascript same as Remote action? can oyu explain this scenario....


Thanks,

vicky

bob_buzzardbob_buzzard

Action function relies on a full postback, so that will maintain state between requests.  JavaScript remoting is a stateless and simply executes a request based on the parameters.  Remoting is way faster as the viewstate doesn't have to be deserialized from the form posted back and all the property setters executed.

This was selected as the best answer