<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Set/get CustomAttribute issue in v4.3.6]]></title><description><![CDATA[<p dir="auto">Hi, </p>
<p dir="auto">We have upgraded our NetXMS system from v3.9 to v4.3.6 and since then the set and getcustomattribute functions are not working properly. I use these functions in a trap processing script as below:</p>
<p dir="auto">// fmRadioAlarmState (0:warning event, 1:critical event, 2:alarm ceased)<br />
//m - contains the unique ID of the alarm<br />
  t = time();<br />
  evts = " ON";<br />
  str3 = "";<br />
  switch($event-&gt;parameters[2])<br />
  {<br />
      case 0:<br />
        evt = "SME_PIRA_TRAP_WARNING";<br />
        break;<br />
      case 1:<br />
        evt = "SME_PIRA_TRAP_CRITICAL";<br />
        <strong>$node-&gt;setCustomAttribute(".signalLossTime" . format(m, 1, 0), t);</strong><br />
        break;<br />
      case 2:<br />
      evt = "SME_PIRA_TRAP_CLOSE";<br />
      evts = " OFF";<br />
      <strong>t0 = $node-&gt;getCustomAttribute(".signalLossTime" . format(m, 1, 0));</strong><br />
      if (t0 != null)<br />
        {<br />
        str3 = "Starting from:" . strftime("%Y.%m.%d %H:%M:%S", t0) . ", duration: " . format((t-t0), 1, 0) . "s";<br />
        }<br />
      break; <br />
      default:<br />
        evt = "SME_PIRA_TRAP_INFO";<br />
        break;<br />
  }</p>
<p dir="auto">As I see the main problem is that the getcustomatrribute function always returns null. Anyone have any idea what could be the problem?</p>
<p dir="auto">Thank you in advance.</p>
]]></description><link>https://forum.netxms.org/topic/7685/set-get-customattribute-issue-in-v4.3.6</link><generator>RSS for Node</generator><lastBuildDate>Fri, 13 Nov 2026 08:32:38 GMT</lastBuildDate><atom:link href="https://forum.netxms.org/topic/7685.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 31 May 2023 11:40:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Set/get CustomAttribute issue in v4.3.6 on Tue, 06 Jun 2023 06:49:13 GMT]]></title><description><![CDATA[<p dir="auto">I was not able to replicate this. What kind of ID do you have in m variable, is it decimal number or hex?</p>
<p dir="auto">I'd try a few things:</p>
<ul>
<li>executing this script via "Execute server script" from node context menu. May be you'll see some errors there.</li>
<li>you can try removing the dot from the beginning of custom attribute name - in this case custom attribute will be visible in node properties. Does setCustomAttribute actually add custom attribute to the node?</li>
</ul>
]]></description><link>https://forum.netxms.org/post/32500</link><guid isPermaLink="true">https://forum.netxms.org/post/32500</guid><dc:creator><![CDATA[Filipp Sudanov]]></dc:creator><pubDate>Tue, 06 Jun 2023 06:49:13 GMT</pubDate></item></channel></rss>