4 Replies Latest reply: Oct 3, 2012 1:58 PM by user552098 RSS

    How can Event Handler show error message on UI screen?

    user552098
      I have created a pre-process Event Handler that triggers on the CREATE operation of a User object. If this event handler detects an error, I want to be able to generate an error message that is visible to the user on the UI screen. I understand that errors should be returned by throwing the EventFailedException object. However, everything I try to do only results in some generic message being displayed. My custom message does not display. How can I get my custom error message to display on the UI when the create user fails in my pre-process Event Handler?

      Here is the message that I get in all cases that I've tried:

      An error occurred while performing create user operation. The create operation on user entity failed in action stage.

      Although this is correct, it doesn't tell the user why it failed. My custom error message would do that so I need to get that message to display here. Is there a way to do that?

      Thank you.
      -Dave
        • 1. Re: How can Event Handler show error message on UI screen?
          Dhananjay Neeraj2
          If it is OIM 11g,
          Follow steps written in:

          8.20 Defining Error Messages

          http://docs.oracle.com/cd/E27559_01/dev.1112/e27150/creadp.htm#OMDEV2658

          After that use following constructor of EventFailedException to send your custom Error message... Give null values for other values...
          EventFailedException(long processId, String errCode, String errMessage, String adlMessage, String eventName, Throwable cause)
          • 2. Re: How can Event Handler show error message on UI screen?
            user552098
            Just one point of clarification on this.

            When defining the Error Message in the Design Console, there are three pieces of information:
            1 - Key (generated by OIM when creating the error msg definition)
            2 - Code
            3 - Description

            In the constructor to the EventFailedValidationException, you specify entering the errorCode and errMsg. Which of these map to fields in the Error Message Definition? Does errorCode supposed to be set to the Key or Code field? Then does errMsg in the constructor have to match the Description field, or can it be anything that is dynamically generated?

            Thank you.
            -Dave
            • 3. Re: How can Event Handler show error message on UI screen?
              Dhananjay Neeraj2
              String errCode is supposed to be the Error code. And error message should be the description.
              • 4. Re: How can Event Handler show error message on UI screen?
                user552098
                I'm still not quite clear on how this works.

                The constructor to the EventFailedException object passes in an errCode and errMessage. The errCode parameter MUST match the Code field from the Error Message Definition that was created in the Design Console, right?

                Then the errMessage parameter in the EventFailedException constructor MUST match the Description field from the Error Message Definition that was created in the Design Console? Or can my errMessage parameter be any message text my event handler wants to use?

                Thanks.
                -
                Dave