SetWindowAttributes Overview

Because of the nature of the service, SetWindowAttributes is often the last service on the process canvas. It can be helpful to developers because it can act as a Forward service while displaying a message to the user. It can forward to a specified url or refresh the current window. When the service is called from within a modal window (a window that disables the main window, but keeps it visible with the modal window as a child window in front of it), you also have the option to close the modal window and refresh the parent url.

SetWindowAttributes Use Examples

Closing a Modal Window

This process is used to Turn on Edit mode in one of the applications. When user clicks turn on edit mode, a modal window (a window that disables the main window, but keeps it visible with the modal window as a child window in front of it) appears asking for login credentials. Once user enters the credentials and clicks the “Turn On Edit Mode” button, this process runs. We then confirm whether the user has entered valid credentials, if yes we turn the edit mode on and then use “SetWindowAttributes” to close the Modal window and refresh the parent page.

Here’s a closer look at SetWindowAttributes in this process. Notice that we are only using “CloseWindow” and “RefreshParentWindow” parameters in the inputs. If the inputs are left blank their default value is False.

If the SetWindowAttributes is not used in a popup window like this, CloseWindow has no affect. Also, if it is not in a popup window, RefreshParentWindow can have undesired results and should not be used.

Displaying a Popup Message

Basic Popup Message

In this process we are updating user details and based on the success of update, we are displaying an error message or success message and reloading the page.

These are the inputs for “SetWindowAttributes” which are used to display the success message in this process. Notice the popup message input; we are adding field value and concatenating our own text to it.

In this example the SetWindowAttributes was in a modal (popup) window, so in order to refresh the page following the message to the user, we put “Yes” for “RefreshParentWindow”. If the SetWindowAttributes is not in a modal window, do not use this feature as it will have undesired results.

These are the inputs for “SetWindowAttributes” which are used to display the error message in this process.

Notice, there is no setting to refresh the page. In this instance, we simply want to display a message to the user and leave the user on the page. This allows them to keep their existing in put in the textboxes or fields and attempt to fix the issue.

Here is an example of what a SetWindowAttributes message can look like:

Formatting your Popup Message

In the example below these two messages are separated by a new line character “\n”

Here is an example of a message in an Evaluate service which will be used in a SetWindowAttributes message. Notice the \n to create new lines between each message.

Using Redirect Parent Url

SetWindowAttributes and GetRequestAttributes

These two services are often used together when the page you want to reload contains query strings. One example of this is the Order Details page. This is a page that pertains to a particular order, so it has a specific OrderNumber, OrderType, and OrderCompany. When the user clicks the Reorder button, we want the button to perform some actions and then return us to the same page.

Here is the process canvas. When the “Reorder” button is clicked, we call a process which does all the reorder logic. Then we run GetRequestAttributes which tells us the exact url we were on with all the query strings.

We can pass that variable into SetWindowAttributes so it forwards the user here when the service runs.

Hard coded page

In this example, the process is adding items to the cart. So when it is successful, it forwards the user to the shopping cart page