+ Start a Discussion
ashokdddashokddd 

hi.. could you please anyone give differences between apexclasses and triggers??

Vatsal KothariVatsal Kothari
Hi Ashok,

You can refer below link:

https://help.salesforce.com/HTViewHelpDoc?id=faq_apex_classes_triggers.htm&language=en_US (https://help.salesforce.com/HTViewHelpDoc?id=faq_apex_classes_triggers.htm&language=en_US)

If this solves your problem, kindly mark it as the best answer.

Thanks,
Vatsal
WikWik
Hi Ashok,

https://help.salesforce.com/HTViewHelpDoc?id=faq_apex_classes_triggers.htm&language=en_US
AshlekhAshlekh
Hi Ashok,

Apex Class : Apex class is class where you can write your logic and then you can use this class with many componets like.. With VFP, in trigger , components.
Apex class are used to execute our logic we need to call class method or logic and we can use.

Apex Trigger: A trigger is Apex code that executes before or after the following types of operations: insert. update. delete. In trigger you can write logic but you can't create instace of the trigger becasue trigger is place where a code can be run on any event, we can use class in trigger but we can't use trigger in class.
David "w00t!" LiuDavid "w00t!" Liu
Triggers are like event listeners in Salesforce - they run immediately when a specific event happens. Possible events are before / after combined with insert / update / delete / etc etc.

Classes are blocks of code that are only run when specifically called upon, unlike triggers which automatically run whenever a certain event happens. You can call classes from triggers.
Amith RaoAmith Rao
Apex Classes : are blocks of code that are only run when specifically called upon.
Apex Triggers : are like event listeners in salesforce which automatically run whenever a certain event happens.

Apex Classes : can be used with many components like the VFP, triggers, VFC(components).
Apex Triggers : is apex code that executes before/after the following types of operations :insert,upate,delete etc.

Classes : We cannot use triggers within classes.
Triggers : We can use classes within triggers.

Classes: We can call class method/logic and can create instance of a class.
Trigger : Can write logic , but you cant create instance of the trigger because trigger is a place wher code can run based on events.