mitchspano / apex-trigger-actions-framework

A framework for partitioning, ordering, and bypassing trigger logic for applications built on Salesforce.
Apache License 2.0
512 stars 161 forks source link

Type.forName not namespace safe #152

Open yippie opened 4 months ago

yippie commented 4 months ago

If packaged, Actions and Finalizers use an API that cannot access classes outside of the same package. Salesforce Documentation on the Type.forName warns of this and suggests using an alternative API https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_type.htm#apex_System_Type_forName

This adds new Apex_Class_Namespace fields and uses the more explicit and safer version of Type.ForName. I also included a fallback to make sure no existing functionality is lost.

Expected Behavior

Custom action to run

Actual Behavior

Non-namespaced action classes will not be found or used

Steps to Reproduce the Problem

  1. Package apex-trigger-action-framework in a Namespaced package.
  2. Create a Trigger action handler that is not namespaced
  3. Create a trigger action for the handler
  4. Do DML to cause the action to happen
yippie commented 4 months ago

Fixed by https://github.com/mitchspano/apex-trigger-actions-framework/pull/149