NetXMS Support Forum

English Support => General Support => Topic started by: mclifford on March 10, 2017, 12:47:56 AM

Title: Add Custom Objects Via SQL Script
Post by: mclifford on March 10, 2017, 12:47:56 AM
It is possible to add custom attributes via a TSQL Script?

I am able to successfully add them to the correct object_id but, when I pull them in the gui I cannot see them.

Title: Re: Add Custom Objects Via SQL Script
Post by: mclifford on March 10, 2017, 05:07:23 PM
I would like to add more detail to my post. I wrote the following sql statement. It completes successfully however when I pull up the custom properties of object_id 3367 it is blank in the GUI.

Insert Into object_custom_attributes(object_id, attr_name, attr_value) Values (3367, 'AssetTag', '123456')
Title: Re: Add Custom Objects Via SQL Script
Post by: tomaskir on March 14, 2017, 02:27:39 AM
When a client is connected, objects are cached client-side - so you wont see changed done directly in DB.
Restarting the client should be enough.

It might also be a good idea to do DB changed only when the server is off, then run nxdbmgr check, just to make sure database is still in a good health :)
Title: Re: Add Custom Objects Via SQL Script
Post by: mclifford on March 15, 2017, 09:27:07 PM
I found out I have to bounce the core service in order to view the values.

Is there a better way to refresh?
Title: Re: Add Custom Objects Via SQL Script
Post by: Victor Kirhenshtein on April 03, 2017, 11:25:14 AM
Hi,

server caches object data in memory, so direct DB changes while server is working will not be picked up. You can use NetXMS API to modify object custom attributes (either Java API or Python scripts using nxshell).

Best regards,
Victor