OpenWGA 7.0 - TMLScript reference


Object:

profile

Description This object represents the personalisation profile of the current browser user. This is a document which is automatically created for each browser user and stores any settings that just apply to him.

Its main purpose is to to store items which influence the indiviual application behavior for this user. These profile items have the same characteristics as items on content documents. They can be created and read by the OpenWGA design as needed can hold arbitrary data.

Additionally personalisation profiles can automatically collect statistical data about the user, like his number of sessions, his recently used browser etc. These are available as metadata fields of the user profile but it is up to the administrative application configuration in if and which statistics are collected.

There is a shortform syntax for reading items and metadata fields. You can just use the name of the item (in lowercase) or the name of a metadata field (in uppercase) as property of the TMLUserProfile object.

The personalisation profile does also host the registration of WebTML portlets for the current user. These however are not maintained by this object but by object TMLPortlet.

There are different strategies how a personalisation profile is assigned to a browser user, which are also chosen on the administrative configuration. Based on that there are some cases where the current user may not have a profile:
  • If the strategy "login" is configured and the current user is not logged in
  • If the strategy "custom" is configured and no profile has yet been assigned to the user
In these cases the personalisation profile returns null.

All methods of this object are case insensitive and can be used in arbitrary cases though we recommend to use the case specified in this documentation.

Changed profile data is stored automatically at the end of each request. The method save(), which was needed to store profile/portlet data in OpenWGA versions prior to 6, is still available for backward compatibility but does nothing now.

Retrieval this.profile
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
    portletevent
Properties and methods
Name Purpose
hasItem(itemname) Tests if an item is available
item(name) Reads the value of a profile item
itemList(name) Returns the value of a profile item as list
meta(name) Reads the value of a metadata field
metaList(name) Returns the value of a metadata field as list
optInStorage() Marks this profile as being allowed for persistent storage
profile Offers the WGAPI object representing the personalisation profile
removeItem(name) Removes an item from the profile
setItem(name, value) Creates or updates a profile item
storageOptedIn Returns if the profile already was allowed to be stored persistently
Examples Reading a profile item, once in full, once in shortform syntax:

profile.item("username")
profile.username


The same with a metadata field, in this case "sessions" holding the number of browser sessions of the user:

profile.meta("sessions")
profile.SESSIONS