Comparing JavaScript Remoting and

The <apex:actionFunction> component also lets you call controller action methods through JavaScript.
In general, <apex:actionFunction> is easier to use and requires less code, while JavaScript remoting offers more flexibility.
Here are some specific differences between the two.
  • The <apex:actionFunction> tag:
    • lets you specify rerender targets
    • submits the form
    • doesn’t require you to write any JavaScript
  • JavaScript remoting:
    • lets you pass parameters
    • provides a callback
    • requires you to write some JavaScript
Both JS Remoting and Action Function call the class's methods that are linked to VF page.

VLOOKUP


Returns a value by looking up a related value on a custom object similar to the VLOOKUP() Excel function
1.       VLOOKUP only available on Custom Objects.
2.       VLOOKUP only available in Validation Rules.
3.       VLOOKUP can only be done on the Name fields.
4.       The field_to_return must be an auto numberroll-up summarylookup relationshipmaster-detail relationshipcheckboxdatedate/timeemailnumberpercentphonepicklisttexttext area, orURL field type.
5.       The field_on_lookup_object must be the Record Name field on a custom object.
6.       The field_on_lookup_object and lookup_value must be the same data type.
7.       If more than one record matches, the value from the first record is returned.
8.       The value returned must be on a custom object.
9.       You cannot delete the custom field or custom object referenced in this function.

E.g.
A simple validation on a Custom Object Invoice__c.
Here vlookup function matches invoice name to value ‘krrish’ if found duplicate then it returns testValues_c field value  of first matches record.

Name=VLOOKUP( $ObjectType.krrish__Invoice__c.Fields.krrish__testValues__c,  $ObjectType.krrish__Invoice__c.Fields.Name,"krrish" )



What is SYSTEM in Salesforce?


System
  • System is a namespace
  • System is a class in System namespace

The System namespace provides classes and methods for core Apex functionality.
The System namespace is auto included in Salesforce Orgs

  1. Address Class
  2. Answers Class
  3. ApexPages Class
  4. Approval Class
  5. Blob Class
  6. Boolean Class
  7. BusinessHours Class
  8. Cases Class
  9. Comparable Interface
  10. Continuation Class
  11. Cookie Class
  12. Crypto Class
  13. Custom Settings Methods
  14. Database Class.
  15. Date Class
  16. Datetime Class
  17. Decimal Class
  18. Double Class
  19. EncodingUtil Class
  20. Enum Methods
  21. Exception Class and Built-In Exceptions
  22. FlexQueue Class
  23. Http Class
  24. HttpCalloutMock Interface
  25. HttpRequest Class
  26. HttpResponse Class
  27. Id Class
  28. Ideas Class
  29. InstallHandler Interface
  30. Integer Class
  31. JSON Class
  32. JSONGenerator Class
  33. JSONParser Class
  34. JSONToken Enum
  35. Limits Class
  36. List Class
  37. Location Class
  38. Long Class
  39. Map Class
  40. Matcher Class
  41. Math Class
  42. Messaging Class
  43. MultiStaticResourceCalloutMock Class
  44. Network Class
  45. PageReference Class
  46. Pattern Class
  47. Queueable Interface
  48. QueueableContext Interface
  49. QuickAction Class
  50. RemoteObjectController
  51. ResetPasswordResult Class
  52. RestContext Class
  53. RestRequest Class
  54. RestResponse Class
  55. SandboxPostCopy Interface
  56. Schedulable Interface
  57. SchedulableContext Interface
  58. Schema Class
  59. Search Class
  60. SelectOption Class
  61. Set Class
  62. Site Class
  63. sObject Class
  64. StaticResourceCalloutMock Class
  65. String Class
  66. System Class
  67. Test Class
  68. Time Class
  69. TimeZone Class
  70. Trigger Class
  71. Type Class
  72. UninstallHandler Interface
  73. URL Class
  74. UserInfo Class
  75. Version Class
  76. WebServiceCallout Class
  77. WebServiceMock InterfaceXmlStreamReader Class
  78. XmlStreamWriter Class


System is Class:
Contains methods for system operations, such as writing debug messages and scheduling jobs.

Always use static .method in trigger contaxt since trigger runs  always in System Contaxt

Trigger Context Variables


  1. isExecuting--Returns true if the current context for the Apex code is a trigger, not a Visualforce page, a Web service, or an executeanonymous() API call.
  2. isInsert
  3. isUpdate
  4. isDelete
  5. isUndelete--Returns true if this trigger was fired after a record is recovered from the Recycle Bin (that is, after an undelete operation from the Salesforce user interface, Apex, or the API.)
  6. isBefore--Returns true if this trigger was fired before any record was saved.
  7. isAfter--Returns true if this trigger was fired after all records were saved
  8. new--Returns a list of the new versions of the sObject records.Note that this sObject list is only available in insert and update triggers, and the records can only be modified in before triggers.
  9. old--Returns a list of the old versions of the sObject records.
    Note that this sObject list is only available in update and delete triggers.
  10. newMap--A map of IDs to the new versions of the sObject records.
    Note that this map is only available in after insert, and update triggers.
  11. oldMap--A map of IDs to the old versions of the sObject records.Note that this map is only available in update and delete triggers.
  12. size--The total number of records in a trigger invocation, both old and new.
  13.  Table for defining contaxt variable values "NULL" or "NOT  NULL" 
  14. TCV*
    Before Insert
    After Insert
    Before Update
    After Update
    Before Delete
    After Delete
    After Undelete
    New
    NOT NULL,
    MODIFIABLE
    NOT NULL
    NOT NULL,MODIFIABLE
    NOT NULL
    NULL
    NULL
    NOT NULL
    Old
    NULL
    NULL
    NOT NULL
    NOT NULL
    NOT NULL
    NOT NULL
    NULL
    newMap
    NULL
    NOT NULL
    NOT NULL
    NOT NULL
    NULL
    NULL
    NOT NULL
    oldMap
    NULL
    NULL
    NOT NULL
    NOT NULL
    NOT NULL
    NOT NULL
     NULL
*TCV->Trigger Context Variable

Events
trigger.old
trigger.oldMap
trigger.new
trigger.newMap
before insert
after insert
before update
after update
before delete
after delete
after undelete




About Static and instance Method

public class SecondClass
{
int i;
public int sum()
{
int i=5;
return i+this.i;
}
}
---------------------
public class FirstClass
{
public static void main(String args[])
{
SecondClass m=new SecondClass();
m.i=7;
System.out.println("Sum="+m.sum());
}
}

----------------------------

Output:

Sum=12
=============================
public class SecondClass
{
int i;
 public static int sum()
{
int i=5;
return i;
}
}
---------------------
public class FirstClass
{
public static void main(String args[])
{
 SecondClass m=new SecondClass();
 m.i=7;
 System.out.println("Sum="+m.sum());
}
}

static methods are  very far from object instance.that are totaly link to a class.
an another point that static methods can never user non-static members.

Counters