itemChannelLink

items. Namespace

Description:
  • Item channel link namespace. This namespace provides access to Item channel links.

Source:

Classes

ItemChannelLink

Methods

Description:
  • Adds a new channel link to an Item.

    If this is called from file-based scripts, the Item -> channel link is registered with the ScriptedItemChannelLinkProvider and shares the same lifecycle as the script. You can still persist the Item -> channel link permanently in this case by setting the persist parameter to true. If this is called from UI-based scripts, the Item -> channel link is stored to the ManagedItemChannelLinkProvider and independent of the script's lifecycle.

Source:
Parameters:
Name Type Attributes Default Description
itemOrName Item | string

Item or the name of the Item

channelUID string
configuration object <optional>

channel configuration

persist boolean <optional>
false

whether to persist the Item -> channel link permanently (only respected for file-based scripts)

Throws:

if the Item -> channel link already exists

Type
Error
Returns:

the ItemChannelLink

Type
ItemChannelLink
Description:
  • Gets a channel link of from an Item.

Source:
Parameters:
Name Type Description
itemOrName Item | string

Item or the name of the Item

channelUID string
Returns:

the ItemChannelLink or null if none exists

Type
ItemChannelLink | null
Description:
  • Removes a channel link from an Item.

Source:
Parameters:
Name Type Description
itemOrName Item | string

Item or the name of the Item

channelUID string
Returns:

the removed ItemChannelLink or null if none exists, or it cannot be removed

Type
ItemChannelLink | null

(static) removeLinksForItem(itemName) → {number}

Description:
  • Removes all channel links from the given Item.

Source:
Parameters:
Name Type Description
itemName string

the name of the Item

Returns:

number of links removed

Type
number
Description:
  • Removes all orphaned (Item or channel missing) links.

Source:
Returns:

number of links removed

Type
number
Description:
  • Adds or updates a channel link of an Item. If you use this in file-based scripts, better use addItemChannelLink to provide channel links.

    If an Item -> channel link is not provided by this script or the ManagedItemChannelLinkProvider, it is not editable and a warning is logged.

Source:
Parameters:
Name Type Attributes Description
itemOrName Item | string

Item or the name of the Item

channelUID string
configuration object <optional>

channel configuration

Returns:

the old ItemChannelLink or null if it did not exist

Type
ItemChannelLink | null