To access configuration, use require('appData') in a server side script context.

Global AppData [@since 5.2]

Global appData is configuration that is shared among all instances of a WebApp. Configuration of global appData takes place in the addon-view of the Sitevision editor (found in the app's context menu when a config/global/index.html file is present).

To access global configuration, use require('globalAppData') in a server side script context.

The globalAppData-object and the regular appData-object share all features.

Using AppData for HTML input elements

// index.html
<input name="theTextField">
// index.js
const appData = require('appData');
// returns the text value from the input field
text = appData.get('theTextField');

Using AppData for Sitevision components

// index.html
<div class="form-group">
   <input class="form-control" data-component="page-selector" name="page">
<div class="form-group">
   <input type="hidden" data-component="page-list" name="pages">
// index.js
const appData = require('appData');
const globalAppData = require('globalAppData');
// returns the JCR Node
page = appData.getNode('page');

// returns the JCR Node identifier i.e: '4.540818ed12a6539aa3f80001645'
pageId = appData.get('page');

 * returns an object with given properties of the JCR Node i.e:
 *   {
 *      URI: '/4.540818ed12a6539aa3f80001645.html',
 *      displayName: 'Home',
 *      published: true,
 *      publishDate: 1227618333142
 *   }
pageData = appData.get('page', 'URI', 'displayName', 'published', 'publishDate');

/* getArray [@since 4.5.3]
 * returns value as an array
 * - an array of JCR Nodes for list components
 * - value wrapped in an array for single type components
pages = appData.getArray('pages');

Default AppData values[@since 9.0]

Default appData values are declared in "appDataDefaults.json" stored in the root of the app.

// appDataDefaults.json
  "appData": {
  "globalAppData": {

A default value will be used until there is a value configured by a user. Once a value is saved from the configuration, the default value will never be used again, even though a value might be cleared.

Sitevision identifers should never be used as default values.

AppData for the Sitevision metadata selector

The metadata selector manages a metadata definition. Though, in many cases the metadata value is of interest.

Tip! The metadata value for a specific node can be resolved using the name of the metadata definition.

// index.html
<div class="form-group">
   <select class="form-control" data-component="metadata-selector" name="metadef"></select>
// index.js
var appData = require('appData'),
   portletContextUtil = require('PortletContextUtil'),
   propertyUtil = require('PropertyUtil'),

// Get the metadata definition JCR Node
metadataDefinition = appData.getNode('metadef');

// Get the name of the metadata definition and the Node of interest
nameOfTheMetadata = metadataDefinition.getName();
currentPage = portletContextUtil.getCurrentPage();

// ...and resolve the metadata value
metadataValue = propertyUtil.getString(currentPage, nameOfTheMetadata, '');

Sitevision node types

Refer to the node types documentation to see what properties are available for different node types. Values retrieved from appData.get() are JavaScript compatible.

  • PropertyType.DATE returns a timestamp
  • PropertyType.WEAKREFERENCE returns an ID