Create Events with Output and attach them to a widget

  • Max
        Has successfully completed the online course Introduction
        Has successfully completed the online course Intermediate (200)
        Has successfully completed the online course Advanced (300)
        Has successfully completed the online course Basics (100)
        Has successfully completed the online course Advanced (310)
      1 year ago #38517

      Is it possible to create an event which returns something when it gets fired? For example I have a button and when it gets pressed an event is fired which also returns the id and text of the button.

       

      Regards, Max

      Armin Winkler
          Has successfully completed the online course Introduction
          Has successfully completed the online course Intermediate (200)
          Has successfully completed the online course Advanced (300)
          Has successfully completed the online course Basics (100)
        1 year ago #38518
        Up
        1
        Down
        ::

        Hi Max,

         

        are you talking about a custom event that should be fired here or do you want to know about a native widget event that is available from the OpenUI5 framework? If your question concerns the latter, than you can look up any widget event that is available for subscription in the Process Designer here, e.g. the press event of the button: https://sapui5.hana.ondemand.com/#/api/sap.m.Button%23events/press Every OpenUI5 event grants you access to the calling widget via the following command: oEvent.getSource(). If an event outputs additional parameters, you can access them this way: oEvent.getParameter(“<yourParameterName>”).

         

        However, if your question is regarding custom events in Simplifier then no, unfortunately parameters are not supported by them. They can be used for cross-linking logic between Process Designer stories or for reusability of process logic for example. Perhaps our documentation on events may also provide you further help: https://community.simplifier.io/doc/current-release/applications/add-application-logic/events/

         

        Hope this helps, kind regards,

         

        Armin

        Armin Winkler
            Has successfully completed the online course Introduction
            Has successfully completed the online course Intermediate (200)
            Has successfully completed the online course Advanced (300)
            Has successfully completed the online course Basics (100)
          1 year ago #38544
          Up
          1
          Down
          ::

          Hi Max,

           

          all you need to do is use that command oEvent.getSource() and paste it into the code editor within a script activity in the Process Designer or alternatively in a client-side business object function, as this is a method that can be invoked on the native OpenUI5 widget using Javascript. If you connect the button press event subscription with such a script / client-side business object shape in one of your Process Designer stories, then that Javascript code will be executed as soon as the button gets pressed. The output of oEvent.getSource() should return a reference to the sap.m.Button that fired the event and from that you can now retrieve the ID or the button text, by invoking the respective getter methods for the button’s properties Id and text: oEvent.getSource().getId() or oEvent.getSource().getText(), respectively. Again, here are links to the API reference:  https://sapui5.hana.ondemand.com/#/api/sap.ui.base.ManagedObject%23methods/getId & https://sapui5.hana.ondemand.com/#/api/sap.m.Button%23methods/getText

           

          Hope it’s clearer to you now.

           

          Kind regards,

           

          Armin

          Max
              Has successfully completed the online course Introduction
              Has successfully completed the online course Intermediate (200)
              Has successfully completed the online course Advanced (300)
              Has successfully completed the online course Basics (100)
              Has successfully completed the online course Advanced (310)
            1 year ago #38543
            Up
            0
            Down
            ::

            Thanks for your answer, my question was about a custom event that should be fired. But I think your solution with oEvent.getSource() should also work for me.

            But I’m not really sure how to do it. Can you maybe give me an example of how I get the source of the button that got pressed?

             

            Regards, Max

            Max
                Has successfully completed the online course Introduction
                Has successfully completed the online course Intermediate (200)
                Has successfully completed the online course Advanced (300)
                Has successfully completed the online course Basics (100)
                Has successfully completed the online course Advanced (310)
              1 year ago #38545
              Up
              0
              Down
              ::

              Thanks that helped a lot!

            Viewing 5 posts - 1 through 5 (of 5 total)

            You must be logged in to reply to this topic.