OpenWGA 7.9 - TMLScript reference

HDBModel
Method :

assignContentID([content], id)

On object HDBModel
Usage Assigns a content ID to the given content
Description

This method can be used to give a content document a HDBModel content ID. This ID will be used to generate the unique name of the content, so it can be used to navigate to this content.

Ideally the method assignContentID() is used inside HDBModel event script onSave() of one content class and the content id to set is derived from some item or metadata field of the content itself.

The method itself does not save its modifications. So if used outside some save event script a separate HDBModel.updateContent() should be triggered.

Parameters

content (WGAPI object WGContent, optional):

The content which should be given the ID. If not specified the current context is used.

id (String):

The ID to use. Will automatically be run through WebTML encoder "np" to make it a valid content id.

Writable False
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events
Examples

A HDBModel event script, setting the content id automatically to the title of the content:

this.onSave = function(e) {

  HDBModel.assignContentID(content(), TITLE);

}