Activity Forums Salesforce Discussions When would you use the Salesforce @future annotation?

  • When would you use the Salesforce @future annotation?

  • Divya

    Member
    October 25, 2018 at 3:11 pm

    Use cases for @future annotation?

  • Laveena

    Member
    August 26, 2019 at 11:16 am

    Hi Divya,

    1. When you have to make callout to external web-services after DML operation from trigger because it hold the database connection open for lifetime.
    2. Due to sort of resource some method need to run in their own thread, so that it can use that resources when they are available, there you can use future annotation.
    3. Due to limited user’s access on record sometimes DML operation on certain sObject cannot be mixed with DML operation on another sObjects. At that time we need to change the transaction of both DML operation. Here we can use future method.
    Thanks

Viewing 1 - 2 of 2 posts

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos