Activity Forums Salesforce® Discussions What are the different annotations in Salesforce?

  • Shweta

    Member
    April 15, 2020 at 11:06 am

    Annotations are defined with an initial @ symbol.
    Apex supports the following annotations:
    1. @AuraEnabled: It enables client- and server-side access to an apex controller method.
    2. @deprecated: It is used to identify methods, classes, exceptions, enums, interfaces, or variables that can no longer be referenced in subsequent releases of the managed package in which they reside.
    3. @ Future: It is used to identify methods that are executed asynchronously.
    4. @ isTest: It is used to define classes and methods that only contain code used for testing.
    5. @RemoteAction: This annotation provides support for Apex methods used in Visualforce to be called via JavaScript.
    6. @ReadOnly: It allows you to perform unrestricted queries against the Lightning Platform database.

  • Anuj

    Member
    April 15, 2020 at 1:27 pm

    1. An apex annotation modifies the way a method or class is used similar to annotations in Java.
    2. Annotations are defined with an initial @ symbol, followed by the appropriate keyword.
    3. To add an annotation to a method, specify it immediately before the method or class definition.
    EX:-
    Public class classname @ future
    Public static void methodname (String Name)
    Apex supports the following annotations.
    @ Deprecated
    @ Future
    @ Is test
    @ Read-only
    @ Remote action

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos