Notifications
Clear all

[Solved] why isn't my EPT-level action callback being executed?

1 Posts
1 Users
1 Reactions
832 Views
0
Topic starter

In my EPT, I have a callback on an Action.  But when the Action is executed from the UI (or integration), my callback isn't invoked.  Why?

Topic Tags
1 Answer
1
Topic starter

This scenario is often reported as a bug.  However, it is not a bug - it is actually performing in the way the EPT was designed.

EPTs are visible only to the contexts of users within the Enterprise which is using the EPT.  This means if the action is executed by a user from another enterprise, or by a value chain level user, then the EPT callback won't be invoked.  This is by design, to prevent one enterprise from modifying the supply chain processes of another enterprise.

 

That being said, you may have some legitimate scenario where you badly want this type of behavior.  For example, maybe when a Workbench Problem gets created by the value chain user, you want to give an opportunity for the Enterprise from the Owning Org of the problem to add a callback.  This is possible with a bit of SDK work:

 

1) In a module, add a callback on the action in question.  Because it's in the capping module, it will always be called.
2) What this capping module should do is grab some appropriate org from the transaction to figure out which EPT to check.  You can't use the user context since it will be VC.  So it would need to be an owner org on the model, or something similar.
3) Once you have that owner org, you can get the ent from it.  Then create a new ent admin context for that ent using com.onenetwork.platform.common.usercontext.UserContextService.createDefaultEnterpriseAdminContext(Long, String)
4) With that user context in hand, call com.transcendsys.platform.base.util.SptClassLoaderFactory.getSptClassLoader(Long, DvceContext) with it (you can downcast the ent admin context DvceContext)
5) If this doesn't return an EptClassLoader, you don't have to do anything.  
6) If it does return an EptClassLoader, it will have getEptName() on it.  Use that and an approriate naming convention to instantiate a class using com.onenetwork.platform.tools.util.DynamicLoad.loadClass(ClassLoader, String) to get the EPT-defined callback class.  
7) Do previous line in a try catch.  If it doesn't find the class, then you're done, exit quietly
8) If it does find the class, instantiate it and call the appropriate callback method.