Different ways to create Triggers in Salesforce?

|
| By Webner

What are the different ways to create Triggers in Salesforce?

There are three ways of creating a trigger depending upon the type of object in salesforce.

1. Trigger on Standard Object (which have visible property):-
a) Go to Setup->Customize.
b) Open any Standard object (like Accounts) by clicking on arrow button and click on Trigger link in under selected Object.
c) Click on new button.

2. Trigger on Custom object:-
a) Go to Setup-> Create->Objects.
b) There will be a list of custom objects, select any custom object then detailed definition of the custom object will be open which contain trigger section, click on New button in Trigger section.

3. Trigger on Standard Object (which does not have visible property like Attachments):-
a) Go to developer console.
b) Go to New-> Apex Trigger.
c) Select the sObject name from drop down (that is Attachment)
d) Specify the name and save.

The best way is the third one where you can create the trigger related to any object whether it has the property of visibility or not.

Leave a Reply

Your email address will not be published. Required fields are marked *