update class filed on cmn_location table.

adrianonova
Tera Contributor

I need to update class field on cmn_location for many rows. However it is not working for the test I did for only one row.
Follow script I did:(when I ran it, field was populated as 'label').

 

var loc = new GlideRecord('cmn_location');
loc.query('name', 'Key');
while (loc.next()) {
    if (loc.name == 'Key') {
        loc.sys_class_name = 'Building';
        loc.update();
    }
 
adrianonova_0-1743679696449.png

 

}
3 REPLIES 3

Brad Bowman
Kilo Patron
Kilo Patron

There is not a field named 'sys_class_name' out of the box on the 'cmn_location' table.  If you have a custom field in your instance, verify the field name.  Otherwise, you may be displaying this field from a related table in your list view.

you are correct. the field I need to update is 'class' and it didn't work firstly.

then I tried the internal name I found as 'sys_class_name'.

There is also not a 'class' field on this table.  Please share a screenshot of the dictionary entry for this field - for example, the Name field:

BradBowman_0-1743704175751.png