4 Replies Latest reply on Sep 16, 2014 5:39 AM by amiskuma

    'guvnorEditorObject' callback functions not working


      Hi all,

                We are using guvnor 5.3.1 with jBPM 5.2. From our application we create or edit assets(bpmn 2) using standaloneEditor url.

      When it open up, it has 2 buttons like "Save all changes" and "close" as below.



      We need to know when these buttons are clicked.

      I found in the documentation about 'window.guvnorEditorObject' javascript object as :

      var guvnorEditorObject = {

          getDRL: function (callbackFunction),

          getBRL: function (callbackFunction),

          registerAfterSaveAndCloseButtonCallbackFunction: function (callbackFunction),

          registerAfterCancelButtonCallbackFunction: function (callbackFunction),

          getAssetsUUIDs: function()




      I have found this object when editor is opened through firebug.I could call 'getAssetsUUIDs()' and got result.


      But when I registered a callback by 'guvnorEditorObject.registerAfterCancelButtonCallbackFunction(myCallback)' ,


      it was never called when I clicked "close" button. Also Icouldn't see any "cancel" button. Is that the problem. Please give me a solution



      Thanks & regards


        • 1. Re: 'guvnorEditorObject' callback functions not working

          Hi sebastian,

          I tried with this code but tells me that guvnorEditorObject is undefined.

          How do you register the callback functions? Can you show me some code?





          <iframe id="myIframe" src="#{taskHome.designerUrl}"

                                                  width="100%" height="1000px" >



                                        <script type="text/javascript">


                                                            function register() {


                                                                                var guvnorEditorObject = window.document.getElementById('myIframe').contentWindow.guvnorEditorObject;


                                                                                alert('guvnorEditorObject ' + guvnorEditorObject);


                                                                                guvnorEditorObject.registerAfterSaveAllButtonCallbackFunction(function () {




                                                              guvnorEditorObject.registerAfterSaveAndCloseButtonCallbackFunction(function () {

                                                                        alert('saved and close');



                                                              guvnorEditorObject.registerAfterCancelButtonCallbackFunction(function () {






          • 2. Re: 'guvnorEditorObject' callback functions not working



            I'm also facing the same issue. (Using latest drools-guvnor distribution war file)


            I have written the following function to register the callback functions


            function register() {

                        var guvnorEditorObject = window.document.getElementById('myIframe').contentWindow.guvnorEditorObject;


                            //guvnorEditorObject.getDRL(function(drl){alert('drl: '+drl);})

                            //guvnorEditorObject.getBRL(function(brl){alert('brl: '+brl);})

                            guvnorEditorObject.registerAfterSaveAndCloseButtonCallbackFunction(function(){guvnorEditorObject.getDRL(function(drl){alert('drl: '+drl);window.close();})});

                            guvnorEditorObject.registerAfterCancelButtonCallbackFunction(function(){alert('Cancel button clicked');});            






            When I click on "Close" button nothing happens.

            Any help welcome!




            • 3. Re: 'guvnorEditorObject' callback functions not working

              I had a look at source code (5.4) in StandaloneEditorManager


              I removed the following line in JS native method afterCloseButtonCallbackFunction(),



              Here is the updated code function:


              public native void afterCloseButtonCallbackFunction()/*-{   
                  if (confirm("Are you sure you want to close this window?")) {


              Now I'm able to see the prompt asking for the user to close window or not.

              But still the window is not closing after selecting OK.

              I'm using JSF-Richfaces modalpanel along with an iframe to show the custom editor.


              Maybe  $wnd.close(); does not know how to close the modalpanel?

              • 4. Re: 'guvnorEditorObject' callback functions not working

                Hi Sebastian,


                Did you find any work around for this. save all changes is working properly for me but even I could not find the way to register close button. none of the callback methods get called for close button in StandaloneEditor.html. let me know if anything you found.