Process Mapping Logo

Process Mapping - Forums

Sharing 19 years of knowledge and experience

 
Metastorm BPM forums
Sign up Latest Topics
 
 
 


Reply
  Author   Comment  
montesj

Member
Registered:
Posts: 41
Reply with quote  #1 
Details:
Metastorm Designer 9.1.2.2

I have a form (DetailsForm) on a stage which has a user action (Reclassify- this also has a form called ReclassifyForm) that has a property to reopen the folder. So basically the current behaviour that we are getting is that when we submit the ReclassifyForm the DetailsForm will not be closed hence being reloaded.

We need some validation on the Reclassify user action that when a value on the ReclassifyForm is true the DetailsForm will automatically close and when the value is false the DetailsForm will be reopened as what the current behaviour is.

Here is what I did for the solution:
(Assuming that the server side scripts are running before client script)

Open DetailsForm and then click Reclassify to open the ReclassifyForm
-Basically the ReclassifyForm is on Top of the DetailsForm now

On the on submit of the ReclassifyForm I have Process variable "ShouldClose" that is given a value "Yes" or "No" This will server as my marker that the DetailsForm should be closed or not.
e.g. SampleProcessData1.ShouldClose = "Yes";

On the onload of my DetailsForm I have a Process variable "ShouldCloseDetailsForm" that will place a temporary holding variable for the ShouldClose variable because I need to revert this variable to "No" on load.
e.g. SampleProcessData1.ShouldCloseDetailsForm = SampleProcessData1.ShouldClose;
//Some script to update the variable on the database using update sql script

I also have a javascript on the onload of the DetailsForm that will check the temporary holding variable "ShouldCloseDetailsForm" if the form should be closed or not.
e.g.

var  chkShouldClose= GetField("ShouldCloseDetailsForm","");

 if(chkShouldClose== "Yes")

{

 window.top.close();

 }

The above solution is working as expected when i submit the ReclassifyForm, but there is a "glitch" that I not sure why is happening. Every after deployment of the solution the first run will not work but for the second and so will make the solution ok.

I have tried it on my local machine after deployment and it failed to close the first time but after that the issue was resolved after trying again. Also I tried testing it on other machines after I tried it on my local to rule out that it was an issue for every user's first try on the solution but it works as expected. Do you know why the first time it fails?


Please let me know if you need additional details. Thanks for the help!




0
jpesout

Avatar / Picture

Veteran
Registered:
Posts: 107
Reply with quote  #2 
Did you try to trace the JavaScript with console.log or alert? I'd check if the client script is executed at all and then if it gets to the if statement.

Quote:
alert('OnLoad');
var chkShouldClose = GetField("ShouldCloseDetailsForm","");
if(chkShouldClose== "Yes")
{
  alert('ShouldClose');
  window.top.close();
}
0
montesj

Member
Registered:
Posts: 41
Reply with quote  #3 
Yes. I have tried that just to check if it is entering or executing the javascript. The weird thing is that on the first try the message alert is "No" but on the second try it will become "Yes". I am definitely sure that the value is "Yes" since i have some codes that does something if the value is yes aside from closing the window.

var chkShouldClose= GetField("ShouldCloseDetailsForm","");
alert (chkShouldClose);

if(chkShouldClose== "Yes")

{

window.top.close();

}

0
Jerome

Avatar / Picture

Guru
Registered:
Posts: 5,507
Reply with quote  #4 
This seems very complex for something quite simple, but I am not certain what you are really trying to achieve.

Firstly, client scripts run before server scripts, so your early assumption is incorrect., This could be a cause of your issues.

Secondly, why not use a client script on submit to validate (return true to submit, false to prevent submitting), or a server script (set UserError to prevent submitting).

__________________
Post an example, and we will have a much better idea what the problem is. In about 90% of posts, the problem is one of communication. Examples bridge that gap.
0
Previous Topic | Next Topic
Print
Reply

Quick Navigation:


Create your own forum with Website Toolbox!