Creating Background View

A Background view is just like any other view except that it is opened 'Hidden' so the user does not see it.  They are created to perform a set of tasks or calculations for the parent view which is interacting with the user.  They allow the parent view to access and process data from other record types or the same record type to perform a calculation or task.  

Creating the View

A background view is created just like any view the user is going to interface with.  The only difference is that when a background view is opened it is hidden from the user.  

  1. Click on the Plus sign icon to create a new view.
  2. Select the primary record type for this view.
  3. Add the properties that you want in the view.
  4. Click on the "Finish and Load" button to create the view.

For more information on creating views, refer to Views article.

Opening Background View

  • Once the background view is created and the action you want it to perform added, the parent view needs to open the view as hidden.  
  • This is accomplished by utilizing the Open View action and selecting the hidden option.  

Using and Closing a Background View

Since the view needs to run in the background, we need to decide how to close the view when the task is completed. This is very important. Depending on the purpose of the background view, closing the view happens in different places. Here is a list of 3 possible background view types:

  • Opened by parent view, performs a single task, and closes.
  • Opened with parent view, used when needed by the parent view, and closes when the parent closes.
  • Performs system level tasks and closes when the application closes

Execute a Single Task Using the 'On Open' Action

In this method, calculations or tasks are handled when the background view is opened using the On Open or On Int event.  In this case the task or calculation happens immediately and once it is complete the background view is closed.  

  1. In the background view, create the action chain you wish to run when the view is opened.
  2. Add the Close action as the final step in the action chain.
  3. Add your action chain to the On Open or On Int event for the background view.

This method can be useful for checking for duplicates, updating multiple records, copying records, etc.  

Execute Multiple Tasks

In this method, the background view will be opened when the parent is opened and closed when the parent is closed. The benefit of this approach is that the parent view has complete control and can use the background view as needed.

System Tasks (Available to All Views)

In this method, the background view will open when the application opens and close when the application closes.

This is useful for performing system wide calculations, tracking open views, and setting permission levels.  

Chaining Views in the Background

It is quite common for a background view to open additional background views to support the task it needs to perform. The same process outlined in this article is used when a background view opens additional background views.

Tips, tricks, and examples

Using a Background View to Check for Duplicate Records

In this example we are using a background view to evaluate if the new user entered into this pop-up view is a duplicate record.

See the article on Creating Pop-Up Views.  

The Save button performs a series of steps to evaulate if the record is a duplicate before it actually saves the data.  

It performs the actions:

  • Stores a variable to check for duplicates
  • Stores the new user's Full Name to a variable called: {dvVar_newUser.fullName}
  • Opens a background view
  • Then it looks at a variable saved by background view. The variable the background sets will determine what the rest of the action chain does.  

When the Save button is selected the background view is opened and is filtered by the {dvVar_newUser.fullName} variable set earlier in the action chain.    

The background view will have an On Open action that checks if there are records in the grid.

  • If there are records, it means that a user with that name already exists, and it will store True to the {dvVar_newUser.duplicateCheck} variable.  
  • If grid is empty, it means there is no user with that name and False will be stored to the {dvVar_newUser.duplicateCheck} variable.

After that check the background view is closed.

Now that the background view has performed its task the action chain on the Save button continues.

It is going to look at the {dvVar_newUser.duplicateCheck} variable and evaulate how to proceed.  

  • If the variable is False, the record is not a duplicate and the new record is created.  
  • If the variable is True a message is displayed to indicate the record is a duplicate.
Have more questions? Submit a request

0 Comments

Please sign in to leave a comment.