Set/get CustomAttribute issue in v4.3.6
-
Hi,
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:
// fmRadioAlarmState (0:warning event, 1:critical event, 2:alarm ceased)
//m - contains the unique ID of the alarm
t = time();
evts = " ON";
str3 = "";
switch($event->parameters[2])
{
case 0:
evt = "SME_PIRA_TRAP_WARNING";
break;
case 1:
evt = "SME_PIRA_TRAP_CRITICAL";
$node->setCustomAttribute(".signalLossTime" . format(m, 1, 0), t);
break;
case 2:
evt = "SME_PIRA_TRAP_CLOSE";
evts = " OFF";
t0 = $node->getCustomAttribute(".signalLossTime" . format(m, 1, 0));
if (t0 != null)
{
str3 = "Starting from:" . strftime("%Y.%m.%d %H:%M:%S", t0) . ", duration: " . format((t-t0), 1, 0) . "s";
}
break;
default:
evt = "SME_PIRA_TRAP_INFO";
break;
}As I see the main problem is that the getcustomatrribute function always returns null. Anyone have any idea what could be the problem?
Thank you in advance.
-
I was not able to replicate this. What kind of ID do you have in m variable, is it decimal number or hex?
I'd try a few things:
- executing this script via "Execute server script" from node context menu. May be you'll see some errors there.
- 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?
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login