Bharath24
Tera Expert

On the user table if you make any changes to name field calculations, it will instantly reflect on the user records. But this will not be saved. For example:

I added [ext] to the names of all active users, the name field will be changed to First name + Last name +[ext]  : here [ext] was added by the calculation script in the dictionary of name field. This will make changes to the existing records as well as the new records that we create from now.

this will reflect on the form and list view. But when you filter for Name contains [ext], it will only give the records with [ext] which were created after the changes were made in the calculations. 

To get all the names with [ext] at the end, you need to save all the records once. So we need to run a runscript or a schedule job.:

var gr = new GlideRecord("sys_user");

gr.addQuery("field", "value");

while(gr.next){

gr.update()

}

the above script will save all the records once. Then the records will show up in the list filters as well.

 

Thank you.

Please mark this article helpful if you find it useful.

Comments
Chris D
Kilo Sage
Kilo Sage

Thanks for this 🙂

psst, you're missing a gr.query() in your script though! You can also save an extra two lines with updateMultiple as well - and I did setWorkflow(false) to prevent date/time stamps from updating and any BRs from running:

var gr = new GlideRecord('sys_user');
gr.setWorkflow(false);
gr.query();
gr.updateMultiple();

 

Version history
Last update:
‎11-22-2021 01:44 AM
Updated by: