+ Start a Discussion
sudhakar reddy 13sudhakar reddy 13 

what is future mwthod ,when you can be used for one example

suresh dupadasuresh dupada
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_future.htm

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_non_mix_sobjects.htm
Shrikant BagalShrikant Bagal
Please refer following link:

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_invoking_future_methods.htm

Hope its help!
ManojjenaManojjena
Hi Sudhakar ,

Method with future annotation(@future) is know as future method .

Key points for future annotation .

  1.Method which annoted with @Future annotation is called Future method .
  2.Future method  must be static , and can only return a void type.
  3.Parameters must be primitive data types, arrays of primitive data types, or collections of primitive data types but not sobject .
  4.You can not call a future method from other future method .
  5.Method like getContent and getContentAsPDFPageReference  
  6.Future method cannot call  methods  like getContent and getContentAsPDFPageReference .
  7.Future method will not execute with the oreder you called it may very based on the availability of resource .

Example ,One execution context you can not do the DML for both Setup and nonSet up context So to avoid that you need to use future annotation .
To know about that you can check the below link which has one example as well .

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_dml_non_mix_sobjects.htm

You can find one example in belwo link for future method for trigger .

https://developer.salesforce.com/forums/ForumsMain?id=906F0000000BOOGIA4

Let m eknow if it help !! Select as solution to help other if they have same issue .