NetXMS Support Forum

English Support => General Support => Topic started by: joel4321 on November 11, 2010, 06:44:58 PM

Title: Script Library - Access to parent object --> Subnet/Container
Post by: joel4321 on November 11, 2010, 06:44:58 PM
Hi there

Does anyone know if it's possible to access the parent object (e.g. subnet/container group name) in a script?

return $node->parent_name?

I could only found the standard node variables like $node->id, $node->name...

Thank you

Joël
Title: Re: Script Library - Access to parent object --> Subnet/Container
Post by: Victor Kirhenshtein on November 11, 2010, 07:45:16 PM
Hi!

No, it's not possible. I can add this as feature request.

Best regards,
Victor
Title: Re: Script Library - Access to parent object --> Subnet/Container
Post by: joel4321 on November 11, 2010, 10:35:12 PM
Ok, thanks for your quick response.

For our purpose it would be a nice feature because we have several nodes for each subnet with custom names which are in fact our customer company names. For example we could make use of that in the action alerts like email and customize the subjects with the company names.

Thank you very much.

kind regards

Joël
Title: Re: Script Library - Access to parent object --> Subnet/Container
Post by: Victor Kirhenshtein on November 11, 2010, 11:17:55 PM
Added to bugtracker as feature request. :)

Btw, some message customization can be done using custom attributes for the object. For example, you can define custom attribute MESSAGE and then insert it's value into alarm text by using macro %{MESSAGE}. Of course, this is not a replacement for functionality you was asking for, because it requires manual attribute configuration on each node, but it can help in some cases.

Best regards,
Victor
Title: Re: Script Library - Access to parent object --> Subnet/Container
Post by: joel4321 on November 12, 2010, 06:16:20 PM
ok, nice  :)

thanks for mentioning that possiblity, I already figure it out  ;)

So I'm waiting with patience....

keep coding that way, it's great!

kind regards

Joël
Title: Re: Script Library - Access to parent object --> Subnet/Container
Post by: Victor Kirhenshtein on November 28, 2010, 11:21:40 PM
I have added function GetNodeParents in version 1.0.8.

Best regards,
Victor
Title: Re: Script Library - Access to parent object --> Subnet/Container
Post by: joel4321 on December 14, 2010, 11:17:09 AM
Great!

I've tested it, it worked like a charm!

thank you

Joël