Slaesforce FAQ

can you write trigger for managed object salesforce

by Mr. Merle Schoen Published 2 years ago Updated 2 years ago

For the Attachment, ContentDocument and Note standard objects, we can’t create a trigger in the Salesforce user interface. For these objects, we can create a trigger using development tools, such as the Developer Console or the Force.com IDE. Alternatively, we can also use the Metadata API.

yes you can write a trigger or any Apex code using managed package references.Oct 25, 2010

Full Answer

Can we write trigger on managed package?

It is not possible to update the components related to a manage package. There are no limitations to create trigger on a object. So you can create a new trigger on the Account object and add code in it as per your requirement.

Can we write trigger on custom object in Salesforce?

Apex triggers enable you to perform custom actions before or after changes to the Salesforce records, such as insertions, updates, or deletions. The trigger code is stored as metadata under the custom object.

Can we write trigger on sObject?

This sObject list is only available in insert , update , and undelete triggers, and the records can only be modified in before triggers.

Can we write multiple trigger on same object in Salesforce?

Multiple Triggers on the same object But for a particular scenario (such as 'before insert') it is advisable to write single trigger. Writing multiple triggers renders the system unable to recognize the order of execution. Moreover, each trigger that is invoked does not get its own governor limits.

Can we update same object in before trigger?

It's possible in a before trigger, but not recommended. The benefit of using a before trigger is that you're able to make updates to the records being triggered (i.e. the instances of the records in trigger. new or trigger.

Can we update same record in after trigger?

If we create a new instance of an SObject in the Apex Trigger in memory using the Id of the newly created record as provided in the After Trigger context, we can perform an Update DML statement and not get a read only error.

Can a trigger call a batch class?

Yes it is possible, we can call a batch apex from trigger but we should always keep in mind that we should not call batch apex from trigger each time as this will exceeds the governor limit this is because of the reason that we can only have 5 apex jobs queued or executing at a time.

Can we write multiple trigger on single object?

If your packages/applications have domain logic on the same object, it is totally fine to implement multiple triggers per package.

Can we send email through trigger?

You need to create an apex trigger on contact object which send email when contact will inserted. List sendTo = new List(); sendTo. add(myContact.

How many triggers can one object have?

Hi, No, you can have n number of triggers in a single object and the best practice is to have only one trigger per object.

How many triggers we can write on single object Salesforce?

You can write as many triggers per Object, but the allowed limit is 3,000,000 characters for the entire triggers and apex classess for a dev org.

Why is there only one trigger in an object?

We already mentioned how we need to have only one trigger per object since you can't handle the order of execution of triggers in Salesforce. In order to create a trigger covering all objects, you need to create a helper/handler class in the trigger and try to write much less code in the trigger itself.

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z 1 2 3 4 5 6 7 8 9