Thursday, March 2, 2017

Add Custom Code Without Customization - Event Mapping Framework

Finally, something which let's you to fire PeopleCode on delivered components without customizing the delivered one. This is pretty handy and neat.

How to do this? Below are the steps.



1. Create your custom Application Package Code:
Sample code below. Save this with the appropriate name.
import PT_RCF:ServiceInterface;
class AS_EM_CLASS implements PT_RCF:ServiceInterface
   method execute();
end-class;
method execute
   /+ Extends/implements PT_RCF:ServiceInterface.execute +/
   /* Extends/implements PT_RCF:ServiceInterface.execute */
   Warning ("Ok. I am triggered.");
end-method;

2. Define the Related Content Service:
Navigation: PeopleTools> Portal> Related Content Service> Define Related Content Service



3. Configure Event Mapping
Navigation: PeopleTools> Portal> Related Content Service> Manage Related Content Service (Last Tab: Event Mapping)


Use Map the event of the Application Pages to create a new reference.


Instance Information:


Note on Processing Sequence:
You can control whether the application class PeopleCode is executed before or after any PeopleCode program defined for the same event from the component definition.


At the component level, an application class-based service can be associated with one of the following PeopleCode events:
  • PostBuild
  • PreBuild
  • SavePostChange
  • SavePreChange
  • Workflow


At the component record level, an application class-based service can be associated with one of the following PeopleCode events:
  • RowDelete
  • RowInit
  • RowInsert
  • RowSelect
  • SaveEdit
  • SavePostChange
  • SavePreChange

4. Test the setup
Go to your target page and test it.


For this example, the event is mapped to the row inset processing and so, when you try to add a new row, this event gets triggered.



Copyright © Tech Notes