Monday, December 19, 2022

List of Annotations in Salesforce Apex

Usually Annotation means which will specifies the behavior or modifies the way how the particular class or method behaves in salesforce. Based on annotations the functionality or behavior and usage of particular class or method we can simply identify.
  • Each annotation will starts with '@' symbol and followed by name of the annotation
  • To declare a method/class with annotations it must be declared immediately before method/class  
Method with Annotation Example

public class UserHistoryProcessor
{
   @InvocableMethod 
  public static void updateUserHistory(List<Id> userIds)
  {
    //related code here
  }
 
}

List of Available Annotations in Apex

  • @isTest
  • @InvocableMethod
  • @InvocableVariable
  • @future
  • @AuraEnabled
  • @ReadOnly
  • @RemoteAction
  • @TestSetup
  • @TestVisible
  • @Deprecated
Apex REST annotations:
  • @RestResource(urlMapping='/yourUrl')
  • @HttpDelete
  • @HttpGet
  • @HttpPatch
  • @HttpPost
  • @HttpPut
we will discuss about each and every annotations with examples in next post please keep following the blog for latest updates

Thanks for visiting...Enjoy! 

No comments:

Post a Comment

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC)

Understanding Wire vs Imperative Apex Method Calls in Salesforce Lightning Web Components (LWC) Introduction: Salesforce Lightning Web ...