Add Custom Objects Via SQL Script

Started by mclifford, March 10, 2017, 12:47:56 AM

Previous topic - Next topic

mclifford

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.


mclifford

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')

tomaskir

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 :)

mclifford

I found out I have to bounce the core service in order to view the values.

Is there a better way to refresh?

Victor Kirhenshtein

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