0
Using 10.1.5.1

Hello everyone,
I would like to eliminate the window that appears when an entry into an Aux Table through a Post Transition is cancelled. (See attached - "Window from webpage").
I'm not sure if there is a configuration or setting that I need to modify or if there is some JS that I can use to make that window be gone.
Any advise is welcome.
Thank you lots!
Felipe
Attachments:

Accepted Answer

Thursday, September 24 2015, 05:34 PM - #Permalink
0
Hi Lynn,
After several hours of playing around with this issue, I manage to resolve it. Here is the code:
/*************************************************************
The code below attempts to eliminate the message window displayed when the Cancel action is performed on a Post transition edit form.
Note: This was developed in version 10.1.5.1.
By Felipe Mansilla for Serena Software users and js enthusiasts.
**************************************************************/
function HandlePostCancelButton(){
//search location of script
//the script is enclosed in a frame - id = 'frame_buttons' > head
var scriptElement = parent.document.childNodes[0].childNodes[2].childNodes[0].contentDocument.getElementsByTagName( 'script' );

//loop through all the scripts in the frame
for( var i = 0; i < scriptElement.length; i++ ){

var scriptSelected = scriptElement[i];
var scriptCode = scriptElement[i].innerHTML; //extract code with in <script> tag

//snip of code that triggers the message
var sCode = "\n\t\t\t\t\t\tif (id == 2 && bPost) {\n\t\t\t\t\t\t\tvar yes = confirm(\"The original item has already been transitioned.\\n Are you sure you want to cancel?\\n Click OK to cancel the Post operation.\\n Click Cancel to continue the Post operation.\");\n\t\t\t\t\t\t\t\tif (yes)\n\t\t\t\t\t\t\t\t\tbSuccess = parent.view.goSubmit(id, bPost);\n\t\t\t\t\t\t\t\telse \n\t\t\t\t\t\t\t\t\tbSuccess = false;\n\t\t\t\t\t\t}";

//look for code snip in the <script> content
var bFound = scriptCode.indexOf( sCode );

if( bFound !== -1 ){
//get parent of node
//this is important as we will need to insert the code in the same section
var scripParent = scriptElement[i].parentNode;

//code to replace the window message
var sReplace = "\n\t\t\t\t\t\tif (id == 2 && bPost) {\n\t\t\t\t\t\t\tbSuccess = parent.view.goSubmit(id, bPost);\n\t\t\t\t\t\t}";
//results stores our new script code
var result = scriptCode.replace( sCode, sReplace );

//remove script from document
$( scriptElement[i] ).remove();

//create new script element
var eNewScript = document.createElement( "script" );
eNewScript.type = "text/javascript";
//attach our new code to new script element
eNewScript.innerHTML = result;

//add new script element from where it was removed
scripParent.appendChild( eNewScript );
}
}
}
AddLoadCallback( HandlePostCancelButton );

Feel free to use it and if you do and run into issues let me know.
There are probably better/cleaner ways to do it. But this is currently working.
Sincerely,
Felipe
  • Lynn Mattie
    more than a month ago
    Sorry, I didn't think it would be quite that difficult. Did you enter the enhancement idea?
The reply is currently minimized Show
Responses (4)
  • Accepted Answer

    Tuesday, September 22 2015, 12:33 PM - #Permalink
    0
    I would love to see an enhancement that allows the workflow designer to set an option not to display that message on each post/subtask transition. It is important for some of them, but not important at all for others. If you enter this as an Idea, I would definitely vote for it.

    In the short term, you could probably change the Cancel button to do something else other than a real Cancel. Maybe you could just redirect back to the original item.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, September 22 2015, 01:07 PM - #Permalink
    0
    Hi Lynn,
    Thank you for your response. I'll make sure it gets entered as an idea. Your suggestion is good, and I actually have a similar behavior for a custom 'Return' button on the form.
    Nonetheless, and I guess I neglected to mentioned this, the issue also seems to present it self when accessing a record on an embedded within the Post transition form (when using Work Center).
    For some reason, the message seems to load with the initial call of the page. So, when using the 'X' to close the window or accessing a record on the embedded report. The window closes and the message gets triggered.

    Any thoughts on how to resolve this is also welcome.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, September 22 2015, 01:15 PM - #Permalink
    0
    It sounds like a Close Window callback has been added. I believe you would need to run some JavaScript to remove it, but I haven't tried to do that and I am not sure how difficult it would be.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, September 25 2015, 10:13 AM - #Permalink
    0
    Idea added:

    Link to Idea

    This is my first idea entered. Let me know if you see anything wrong with what I said.
    Thank you Lynn.
    Like
    The reply is currently minimized Show
Your Reply