Thursday, July 7, 2016

Salesforce annotations

  • Denotes methods that are executed asynchronously.
global class MyFutureClass {
 @future
 static void myMethod(String a, Integer i) {
  System.debug('Method called with: ' + a +' and ' + i);
  // do callout, or execute
  // other long-running code
 }
}
@isTest
  • Denotes classes that only contain code used for testing your application. These classes don’t count against the total amount of Apex used by your organization.
@isTest
private class MyTest {
 // Methods for testing
}
@isTest(OnInstall=true)
  • Denotes a test class or test method that executes on package installation
@isTest(OnInstall=true)
private class TestClass {
}

@isTest(SeeAllData=true)
  • Denotes a test class or test method that has access to all data in the organization, including pre-existing data that the test didn't create. The default is false
@isTest(SeeAllData=true)
private class TestClass {
}
@deprecated
  • Denotes methods, classes, exceptions, enums, interfaces, or variables that can no longer be referenced in subsequent releases of the managed package in which they reside
@deprecated
public void limitedShelfLife() {
}
@readOnly
  • Denotes methods that can perform queries unrestricted by the number of returned rows limit for a request
@readOnly
private void doQuery() {
}
@remoteAction
  • Denotes Apex controller methods that JavaScript code can call from a Visualforce page via JavaScript remoting. The method must be static and either public or global.
@remoteAction
global static String getId(String s) {
}
@restResource
  • Denotes a class that is available as a REST resource. The class must be global. The urlMapping parameter is your resource's name and is relative to https:// instance. salesforce. com/services/ apexrest/.
@restResource(urlMapping='/Widget/*')
global with sharing class MyResource() {
}
@httpGet,
@httpPost,
@httpPatch,
@httpPut,
@httpDelete
  • Denotes a REST method in a class annotated with @restResource that the runtime invokes when a client sends an HTTPGET, POST, PATCH, PUT, orDELETE respectively. The methods defined with any of these annotations must be global and static.
@httpGet
global static MyWidget__c doGet()
{
}
@httpPost
global static void doPost() {
}
@httpDelete
global static void doDelete() {
}



No comments :

Post a Comment

Labels

visualforce page ( 13 ) apex integration ( 5 ) apex trigger ( 4 ) csv file from vf page ( 4 ) javascript ( 4 ) csv visualforce page ( 3 ) Too many ( 2 ) call out ( 2 ) integration ( 2 ) rest api ( 2 ) salesforce rest api ( 2 ) salesforce to salesforce integration ( 2 ) sfdc rest api ( 2 ) trigger ( 2 ) 15 digit to 18 digit ( 1 ) DML rows in Apex ( 1 ) Date Conversion ( 1 ) Date/Time conversion ( 1 ) Deploy ( 1 ) Objects to Future Annotated Methods ( 1 ) SFDC limits ( 1 ) Sobject to Future Annotated Methods ( 1 ) Test Class ( 1 ) TimeZone Conversion ( 1 ) Too many dml rows ( 1 ) Too many future calls ( 1 ) annotations ( 1 ) apex code ( 1 ) closed opportunities ( 1 ) commit ( 1 ) convert ( 1 ) create records ( 1 ) csv create records ( 1 ) custom setting ( 1 ) deployment ( 1 ) deployment changeset ( 1 ) disable apex class ( 1 ) disable apex trigger ( 1 ) disable in production ( 1 ) document ( 1 ) download ( 1 ) field name ( 1 ) formula fields ( 1 ) iframe ( 1 ) inactive ( 1 ) intellisense ( 1 ) jsforce ( 1 ) limits ( 1 ) matrix report in vf page ( 1 ) multi select ( 1 ) multi select salesforce ( 1 ) multiselect ( 1 ) paypal ( 1 ) picklist ( 1 ) record type ( 1 ) rollback ( 1 ) salesforce limits ( 1 ) salesforce list ( 1 ) salesforce map ( 1 ) salesforce rest ( 1 ) salesforce set ( 1 ) salesforce1 ( 1 ) sandbox deployment ( 1 ) sfdc collection ( 1 ) sfdc list ( 1 ) sfdc map ( 1 ) sfdc rest ( 1 ) sfdc set ( 1 ) uncommitted ( 1 ) updated field ( 1 ) user ( 1 ) validation rule opportunity ( 1 ) validation rules opportunities ( 1 ) vf page ( 1 )

Ad