Saturday, October 8, 2016

Event Mapping Framework - Hello World and Quirks

Ever since PeopleTools 8.55 was released last year, I have heard fantastic things about the new Event Mapping Framework. I also saw great demos while attending various sessions at Oracle OpenWorld 2016. Although, I know the concept of Event Mapping Framework in theory, I never got a chance to use this functionality. So, I decided to create a simple 'Hello World' example to understand the mechanics.

Step 1: Create a custom App Package

This is the event that we will be mapping to a Component PeopleCode. There is nothing fancy in the event, just a basic 'Hello World' message using MessageBox function.


Step 2: Create a Related Content Service

Navigator > PeopleTools > Portal > Related Content Service > Define Related Content Service


Step 3: Map Related Content Service to Component Event

Navigator > PeopleTools > Portal > Related Content Service > Manage Related Content Service > Event Mapping (Tab) > 'Map the event of the Application pages' hyperlink

Let us add this event to the USERMAINT - 'User Profiles' Component. For this example, let us map our related content service as the 'Post Process' event on the Component PostBuild PeopleCode. This is the same example component which Jim Marion used during his Tips and Techniques session at Oracle OpenWorld this year. I doubt the link will work for long, so grab Jim's slide deck as soon as you can!



Results:

Here we can see that our custom event gets executed as per the Event Mapping Framework configuration. Great!


Quirk:

Now, if we use our custom event and try to execute it as part of another component, say URL_TABLE (PeopleTools > Utilities > Administration > URLs), we will find that it will not get executed. Isn't it a little baffling? Because, even if we perform exactly the same steps as described above, somehow it would appear that something is missing!


After some trial and error, I figured that any custom events mapped to a Component (or Component Record) PeopleCode event via 'Event Mapping Framework' will get executed only if there is some code already associated with the actual Component (or Component Record) PeopleCode.

E.g.: URL_TABLE.GBL.PostBuild (Component PeopleCode) does not contain any code. So, any events mapped to this PeopleCode will not be executed.


Is this working as designed? I really hope not! I hope that it is a bug (or unintended feature) that will be fixed/enhanced in the future releases. Otherwise, it may not be as easy to use the Event Mapping Framework as we expect it to be. Particularly, if we are looking at this framework as an option to reduce customizations.

Updated on December 19th, 2016:
This quirk is no longer a problem as of PeopleTools 8.55.11 release.

Demo of the quirk:


Other resources on Event Mapping Framework:
Chris Malek's Blog
psadmin.io Blog
Jim Marion - Tips and Techniques - OOW16 (may only be available for a limited time)
PeopleSoft Mods by Colton Fisher
PeopleBooks - Mapping Application Class PeopleCode to Component Events

23 comments:

  1. Hi Sasank! Nice investigation work here. I have experienced similar behavior when mapping generic app class code to component events with event mapping. I noticed that the code would simply not fire for some component events. I created a case with Oracle Support on this and they said that it is a bug (Bug 24341432 : INCONSISTENT BEHAVIOR OF EVENT MAPPING) that should get fixed in the 8.55.10 release. Hopefully all of the event mapping quirks will be ironed out soon.

    ReplyDelete
    Replies
    1. Colton - Thanks for reading this and letting me know about the bug. I was going to send this post to you for review since you have done a lot of work with EMF. :)

      Good to hear that there is a potential fix in 8.55.10. I forgot to mention in this post that I tested this in 8.55.03 and 8.55.06 with the same results. Will try to test this in 8.55.10 if I can get my hands on an environment.

      Looking forward to your webinar on Tuesday!

      Delete
  2. Hi Sasank,

    Nice article! Thanks. :)

    I wanted to check with you if you have any idea/faced similar issue where a record.save or record.insert does not work with the EMF on a Component SavePostChange code. I mean the code does successfully fire and goes to success as well but then at the end the intended changes are not there in the database. I looked at the trace and it clearly shows that the changes are roll backed after the processor exits the code of the EMF. Any help would be appreciable.

    ReplyDelete
    Replies
    1. @divesh22 - I have not faced the issue you have described but I have heard several inconsistencies with EMF.

      I have not had a chance to review how it works in 8.55.10. I believe there are some fixes for EMF in the 8.55.10 patch.

      Delete
  3. Hi Divesh/Sasank,

    There are couple issue fixed (that included the quirk mentioned above) and will be delivered in PT85.12 patch and also couple in 13 patch. Also, there are other features added in newer release. Also, let me know any feedback about the EMF that we can address and deliver in further release.

    Thanks

    ReplyDelete
    Replies
    1. Raghavendra - Thanks so much for the update. This is very much appreciated.

      Look forward to reviewing the latest fixes and enhancements to EMF. I will update this post, if I have any feedback.

      Again, thanks a lot for taking time and providing this information!

      Delete
  4. All - I can confirm that the quirk mentioned in this post is resolved in PeopleTools 8.55.11.

    Hope this helps.

    ReplyDelete
  5. Do you know how I can include the "Configure Event Mapping" settings in an App Designer project so I can migrate it from dev to test to prod environments?
    I was able to include the "Related Content Definition" in the project.

    ReplyDelete
    Replies
    1. Hi Jim - You should be able to include the 'Related Content Service' in the project similar to other Related Content migrations.

      Use Definition Type: Related Content Service
      Object Name: Enter the 'Content Reference' name

      E.g.: https://snag.gy/jB2dva.jpg

      Let us know if you are still running into issues. Thanks!

      Delete
    2. This post might help:
      https://pe0ples0ft.blogspot.com/2016/12/event-mapping-framework-migration.html

      Delete
  6. Sasank,
    Thank you for the reply, I figured out how to include it in my app designer project. The confusion was in the "Portal Name", which was "_PTCS_PTEVMAP" and that the "Content Reference Name:", which was "HC_RQ_GRP_TBL_ENRL_GBL". I didn't recognize that included the table "RQ_GRP_TBL" which is what I attached my event to.
    Thanks for making the follow-up blog on migrating environments!
    Jim

    ReplyDelete
  7. Hi Sasank,
    Any idea how to get Event Mapping to work for components such as the Hire event in HR ? As you probably know, the Hire is done through Add Person and this then does a Transfer to the JOB_DATA_HIRE component. But the Hire component cannot be directly accessed via the Portal.

    Any ideas ?

    Thanks.

    ReplyDelete
  8. Hi Sasank,

    That's a great idea - I will try it out.

    Thanks.

    ReplyDelete
  9. Hi Sasank,

    How can we handle component variable in the Event mapping, since it is application class and we want the continue to use the component variable from the delivered code (delivered event code) in the event mapping application class.

    Regards,
    Ganesh A.M

    ReplyDelete
    Replies
    1. Hi Ganesh - You can access everything that is available within the component buffer (including Component Variables) in the Event Mapping App Class.

      You will need to declare the component variable in the Event Mapping App Class as well. I would recommend after your end-class; statement.

      Then you can access the variable without any issues.

      Delete
    2. Hi Sasank..it cleared my doubt..Thanks

      Delete
  10. This is the appropriate blog for anybody who desires to seek out out about this topic. You realize so much its almost arduous to argue with you. You definitely put a brand new spin on a subject thats been written about for years. Great stuff, just great!

    ReplyDelete
  11. Hi Sasank,
    Can we add think-time peoplecode built-in functions to achieve some custom behavior in the event mapping handlers? For e.g. I have MessageBox with Yes/No dialogue box. When clicked Yes, it should execute some and 'No' should execute a different logic. Right now, the code isn't continuing further upon clicking Yes/No. Any thoughts? Thanks!

    ReplyDelete
    Replies
    1. Hi Gouse - What Tools release are you on?

      This is an interesting requirement. I have not tried this but will investigate and get back to you.

      Delete
  12. Hi Sasank,

    Have you come across a scenario where there is an event mapping code that needs to be written on a component's postbuild event and that component is only being called using a transfer from other component?

    Is event mapping supported in this case. Just a quick thought.

    Thanks!

    ReplyDelete
    Replies
    1. Hi Sameer - Sorry for the delay.

      You can review the following post to see if this gives you any ideas:
      https://pe0ples0ft.blogspot.com/2017/02/rc-emf-for-components-not-in-portal-menu.html

      Thanks,
      Sasank

      Delete