FindDCIById

Since 6.2.6

FindDCIById(id, currentNode): DCI

Find DCI by its ID on any data collection target. Unlike GetDCIObject, the owner of the DCI does not have to be known in advance; it can be obtained from the owner attribute of the returned object.

Only objects accessible to the user on whose behalf the script is executed are searched.

If trusted node validation is enforced, currentNode should point to execution context object (instance of NetObj, $node in most cases) and only objects that have it in their trusted objects list are searched. Without currentNode nothing will be found. If trusted nodes are disabled (default server configuration), currentNode can be omitted or set to null.

Table 1. Parameters

id

Integer

DCI id

currentNode

NetObj

Lookup context or null if trusted nodes validation is disabled. Optional parameter.

Return

DCI object or null if not found or not accessible.

>>> dci = FindDCIById(144);
>>> println(dci.name .. " on " .. dci.owner.name);
Agent.Version on netxms-server
>>> FindDCIById(999999)
null