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
cjjcjj 

Can I dynamically generate triggers in a Salesforce production org with an app?

 My understanding is that trigger code has to be created in a sandbox and migrated to production (with the minimum level of test coverage). My question is, can an app generate trigger code dynamically in a production org without that? 

I'm imagining an app that configures a basic trigger code with a couple of variables (values of fields on default objects) that are set by the user. The trigger always does the same thing, it just sets up some automation for particular field values selected by the user. 

I'd love to know that this is possible (as it's an idea to get around some of the hassle of usage of Salesforce that currently we are doing with one-off trigger setup). Please let me know if clarification is needed.

 

Thanks in advance for any help!

-christopher

 

PS. I posted this in "answers" too, but since there were no development-related categories, I figured I should look here. 

James (CloudAnswers)James (CloudAnswers)

Your program could probably not be a force.com native app.  If you could do java or python or some of the other languages, you certainly could deploy a trigger to lots of orgs in a programed way.  Anyone with metadata experience could help you make it.

cjjcjj

Hmm...that's what I was afraid of. Challenge with deploying to lots of orgs is that it needs to be set to configuration of the particular org it is in. So if it was done externally, I guess it would have to have a config screen exposed to user, send results to external app, then deploy the trigger back to org. Is that what you are suggesting? 

 

So is there any way we could leave part of the trigger determined in the org (without having to go through migration process)? example: campaign type field. ie trigger goes to work and just determines when to fire based on the campaign types from the particular org.

 

I guess if this doesn't work I'm just going to have to go lobby for some ideas to get done so silly workarounds don't have to be done!