Interrupt Server Action to get User response

I am trying to maintain a file of email addresses and need to interrupt the flow of the server action that saves the changes to ask the user some questions.

Each email address exists only once and it linked via join files to as many people as necessary e.g. 3 people working in support might all have the same address of

If one of those people changes the email address there are 2 possibilities. All the people need the email changed or only him/her.

This is where I need the user input. In the save action I have code to determine if the email is used by anyone else. If not, just rewrite the changes and move on.

If it is used elsewhere I have to know if I'm changing it for everybody or only for this one employee.

So I need the server action to be something like this

I can get the action to use a popup screen that asks the question but the flow of the server action doesn't wait for it's answer.

I need the action to stop and wait for the response from the popup before continuing on.

Is this possible?


Hi Colin, 

It is possible to do what you need, but not the way you are thinking. 

Remember, this is a client / server architecture, based on requests / responses. Once a response is sent back to the client, the server will not resume. 

Also, your pop-up will be open only at the end of the action, as the JavaScript to click the link/button will be sent to the browser only at the end of the action, in the action's response. 

What you need to do is to start the process, and if you need user input to continue, go to a branch, open your pop-up and finish the action. 

In the pop-up, you can sent a message Popup_Editor_Notify, before closing it. This will execute the action bound to the OnNotify event of the Popup_Editor. You can even reexecute here the same processing action. To know in which step of the action you are you can use input parameter and execute branch's accordingly. 

Or execute a new one. 

Yes, you will have to keep the state of your processing somehow, probably using page local variables or the database. 

Hope it helps.