function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Andreas H.Andreas H. 

General After-Insert-Trigger that is invoked whenever a new record is inserted in SF

For my integration project, I want to be "notified" whenever a new record (i.e. account, contact, lead etc.) is inserted into the SF database of my organization.

 

I understand that it's possible to create individual after-insert triggers for each "object class" (e.g. account), but this approach would not support extensions (e.g. if someone introduces a new object class, e.g. "Vendor").

 

Therefore, I'm looking for the possibility to create a "general" top-level after-insert trigger that is invoked whenever any kind of new record is inserted.

 

Is this supported by the SF API?

CaffeineCaffeine

Andreas,

It's not currently supported and I don't believe there is a workaround possible currently.   Triggers belong explicitly and exclusively to one object type.

 

Hope this helps,

C.

MarkSilberMarkSilber

Caffeine is correct -- but I'm not sure why you would want to "catch" inserts to every object, including custom objects you may not be aware of. If you have specific objects you need to publish "inserts" on, you can do this with workflow and an outbound message (no Apex code triggers required).

 

If you are trying to build some sort of replication between Salesforce and an on-premise database, you should look at tools already designed for this specific purpose (search for integration or replication on the AppExchange). The applications will "poll" the Salesforce system for changes and replicate -- not sure what the minium interval is, but I'm pretty sure it won't be less than 1 minute (which should be sufficient for replication).

Andreas H.Andreas H.

Thanks for the info!

 

Is there a standardized/recommended way for requesting new features for the SF API?

 

I'd love to see this possibility added to a future version of the SF API, so you can get notified whenever any kind of record is added, updated or deleted...

Andreas H.Andreas H.

Thanks for pointing me into the right direction.

 

My goal was to send SF records into an index of an enterprise search software solution, so whenever something's inserted, updated, or deleted the index of the enterprise search product ("Mindbreeze Enterprise Search", www.mindbreeze.com) must be updated accordingly.

MarkSilberMarkSilber

The best place to ask for feature enhancements is using the IdeasExchange. As for publishing the changed records, it can still be done easily with workflow and outbound messages, but you would need to be aware of any new custom objects that are added and build the same workflow (about 5 minutes or less of effort), but considerably more to write the code to receive the message.

 

I believe some of the replication tools can automatically replicate new objects and will even automatically replicate modifications to existing objects (i.e., new fields added).

Andreas H.Andreas H.
Thanks Mark!