OpenWGA 7.0 - TMLScript reference

HDBModel
Method :

getRelationTargets(refContent, contentClass, targetContent [, params])

On object HDBModel
Usage Retrieves all potential target documents of a given relation
Description

This method is useful to retrieve all target documents that a relation may point to for a given document. It utilizes a HQL query und the background to retrieve results.

This method may be used to retrieve potential relation options not only for existing documents but also for documents to be created. Therefor the refContent parameter may take the document that holds the relation, but also all parent document from which the document holding the relation may be created

For existing documents this method will also return the current target of the relation, even if it is no longer contained in the relation filter. Switch this off via the "params" argument if this is not desired.

The optional "params" Lookup table argument can be used to further refine the query executed. It takes the following lookup keys:

  • "extraClause" : An extra HQL clause to insert to the WHERE part of the query
  • "extraParams": A Lookup table containing additional query parameters with key and value
  • "currentTarget": Boolean value specifying if the current relation target on the document should be included, even if it no longer matches the relation filter. Defaults to true.
Parameters

refContent (WGAPI object WGContent

The content document holding the relation, or a parent document from which the document holding the relation is to be created.

contentClass (String):

The content class for which the relation is defined. On updating a content this is always the content class of refContent.

relationName (String):

The name of the relation to fetch targets for

params (Lookup table, optional):

Optional params to the retrieval query

Writable False
Return value A ResultSet of the documents being valid targets for the relation
Allowed in script types
  • WebTML pages and normal WebTML actions
  • Master actions
  • TMLScript tasks in jobs
  • Content type events