Developer

Global Context Management

The global context is a central repository for custom key-value pairs that are available to both application development and configuration. You can place, retrieve, and delete global context values based on their unique keys.

To update a global context, use the updateGlobalContext action. The same syntax and parameters apply as for the local context.

You can insert or update the global context with BO attributes, free text, or custom data. This example shows how tapping a cell triggers the update of the global context for the releaseYear key, with the value coming from the corresponding MovieTitles binding:
<ListItem feed="MovieTitles">
  <Event eventId="onClick">
    <Action actionId="updateGlobalContext">
      <P pid="releaseYear" value="{$MovieTitles.ReleaseYear}" />
    </Action>
  </Event>
</ListItem>
Although tiles should use the local context, they can also access data that is available in the global context. To access global context elements, use the {$_global.<value>} syntax. This example shows how TileWithGlobalContext uses values that are stored in the global context:
<Tile tileId="TileWithGlobalContext">
	<LinearContainer layout="vertical">
        	<!-- Details skipped for brevity -->
		<UIElement type="label">
			<P pid="text" value="{$_global. MovieTitles.ReleaseYear }" />
		</UIElement>
		<UIElement type="label">
			<P pid="text" value="{$_context.type}" />
		</UIElement>
	</LinearContainer>
</Tile>