How to set a value in a field from sc_item_option_mtom table

Alon Grod
Tera Expert

Hi,

Im trying to populated the field 'Return Date' from specific catalog item variable but the field is not populated.
What am I doing wrong?

 

var dt = new GlideRecord('sc_item_option_mtom');
dt.addEncodedQuery('request_item.number=' + current.request_item + '^sc_item_option.item_option_new=4a5677081b8a5510aeb37739cd4bcbeb')
dt.query();
if (dt.next()) {
dt.setValue('u_return_date', dt.getValue('Value'));
dt.update();
}

 

Screen Shot 2023-01-05 at 16.38.45.png

6 REPLIES 6

Also I have just noticed that you are using capital V for field name. But absolutely all field names in ServiceNow are all lower case.

jaheerhattiwale
Mega Sage
Mega Sage

@Alon Grod Where you are writing the above code and which field you want to set and of which table?

Please mark the answer as correct or helpful based on impact
ServiceNow Community Rising Star, Class of 2023