How to update list value in servicenow

Sathwik1
Tera Expert

How to update list field using background script, will set value will work here?

find_real_file.png

14 REPLIES 14

I will check that between can you send me how to update for list fields.. because set value will not work for list...right? 

did you try with the script which i had shared ? you have to pass the sys_id of that record which you want to update into list field. can you add some screenshot if that is not working. 

Ohh seems bit late now but for future references you can do below.

1. Once you have configured above property by removing glide_list from the Value field

2. Go to the list view.

For eg. Open a Group table where you will to have Type updated to multiple options from human_resources to have itil as well. So, apply necessary filter to the List & then update Type field for 1 record.

find_real_file.png

Suppose in case above HR Tier 3 was updated with ITIL type. Then,

find_real_file.png

 

Do a list update by selecting it directly from list view.

For the code part comments are already provided by Harshvardhan & Sudhanshu & should help.

Is the code correct?

var com = new GlideRecord('core_company');
com.addQuery('name','ACME Australia');
com.query();
while(com.next){
com.u_type = "00aba08d3790200044e0bfc8bcbe5dfc";
com.update();
}

for testing add setLimit so it will update one record only and then you can test for all after confirmation. 

 

var com = new GlideRecord('core_company');
com.addQuery('name','ACME Australia');
com.setLimit(1);
com.query();
while(com.next){
com.u_type = "00aba08d3790200044e0bfc8bcbe5dfc";
com.update();
}