Client-side programming

You can add your own client-side application behavior using JavaScript.

InsuranceSuite a single page application, although all significant rendering is done on the server. Your first login sends a GET request that fetches the entire page. Subsequently, most page changes are an AJAX POST request, which swaps out portions of the DOM (Document Object Model) and replaces them with HTML sent from the server. You will typically get another GET request only if you explicitly press Refresh in the browser or log out.

The JavaScript environment is initialized from scratch only on the GET requests, which are rare. The more usual AJAX POST requests significantly alter the DOM, but do not destroy the JavaScript state. You must be careful to clean up any global state that you create in your JavaScript. For example, if you have a template panel that adds a global event handler, then by default that handler will exist indefinitely, even if you navigate to other PCF pages that do not contain the panel.

Remember that the DOM is not under your control. PolicyCenter may replace large portions of the DOM during a PCF page transition, or even when staying on the same PCF page but changing the state significantly. For example, the DOM is changed when going from read only to edit mode, or when executing a complex post-on-change request that affects several controls. PolicyCenter rerenders the entire current state on the server side, and then sends any differences to the client side. Depending on the size and number of these differences, the DOM may change a lot or a little, and the area of the page you are manipulating using JavaScript may or may not be affected. In general, it is good practice to assume that any server request may have altered the section of the DOM that you are changing, so make sure to explicitly ensure that things are synchronized after each request.

The client side preloads the following standard libraries:
  • jQuery, used for basic DOM manipulation.
  • d3, used for charts and graphing.

The client also has an extensive Guidewire-specific library. Because PolicyCenter is so different from common client-centric web frameworks, it does not use one of the standard frameworks such as React or Angular.

See also