The Multisite APIs provide an option to write custom pre- and post-hooks for each API to implement custom logic. A pre-hook is run before the actual API runs. A post-hook runs after the actual API runs.
-
Write the custom class to implement the pre and post hook.
Example code:
1 global with sharing class MSCustomHookImplementation implements vlocity_cmt.VlocityOpenInterface 2 { 3 global Boolean invokeMethod(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) 4 { 5 if( methodName.equalsIgnoreCase('getGroups.PreInvoke')) 6 { 7 getGroups_PreInvoke(methodName, input, output,options); 8 return true; 9 } 10 11 if( methodName.equalsIgnoreCase('getGroups.PostInvoke')) 12 { 13 getGroups_PostInvoke(methodName, input, output,options); 14 return true; 15 } 16 17 return false; 18 } 19 20 private void getGroups_PreInvoke(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) 21 { 22 //This method gets called before getGroups 23 } 24 private void getGroups_PostInvoke(String methodName, Map<String, Object> input, Map<String, Object> output, Map<String, Object> options) 25 { 26 //This method gets called after getGroups 27 } - Create the interface implementation.
- Create a new Interface Implementation Detail for the interface created above.