Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating Apex Trigger #294

Open
michelhabib opened this issue Jun 6, 2023 · 0 comments
Open

Creating Apex Trigger #294

michelhabib opened this issue Jun 6, 2023 · 0 comments

Comments

@michelhabib
Copy link

Hi Andrew, @afawcett
I am trying to create an Apex Trigger dynamically using your fantastic wrapper, I am building a managed package for the AppExchange.
After looking everywhere, here are the suggestions I found:-
1- Create the Trigger statically. Not a solution in my case, since I may need different triggers on different objects with different events - based on user input.
2- Use Tooling API. I am reading comments that this is not going to work in Production Org, hence will not work through Managed packages like mine, and I cannot validate this yet.
Can I use Tooling API through Managed Package Code? It still sounds like a hard to implement solution.
3- Use Metadata API (with the Apex Wrapper here) to deploy Apex Triggers? I am still looking for examples on how to do that, but it sounds like an interesting solution if it uses the Apex Wrapper library here, as I am using this library everywhere.
Tip: I found references to your open source DLRS and I expect this class to have the required code:
https://github.com/SFDO-Community/declarative-lookup-rollup-summaries/blob/main/dlrs/main/classes/RollupController.cls
4- Use Metadata API to dynamically create Flows/Apex Actions. Knowing that my trigger execution code itself can be static, but not the trigger definition, so the Apex Action can be the same for all triggers/events. An out of the box idea I thought about, but I am afraid to go this path and hit any limitations.

I apologize for not adding links or code here (yet), but as I am uncovering the solution, I promise to post a working example :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant