- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 07:51 AM
Hi All,
I am doing some clean up and need help. I extended the CMDB_CI table and added a class called "Mobile Devices" for our phones and tablets but I didn't use the "NAME" field and now I can't see them from the reference field on my incident form.
Could someone share a script that will do the following?:
Table "u_mobiles devices"
If "u_imei_string" is not empty, copy the value in to the "name" field.
I plan to put a business rule in place to copy this in the future or I can just add the name field to the form.
Please let me know thoughts and if you are willing to share a script.
Thank you
Carl
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 07:59 AM
var gr = new GlideRecord('u_mobiles_devices');
gr.query();
while (gr.next()) {
var x = gr.getValue('u_imei_string');
if (x) {
gr.setValue('name', x);
gr.update();
}
}
You could run that as a background script.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 07:59 AM
var gr = new GlideRecord('u_mobiles_devices');
gr.query();
while (gr.next()) {
var x = gr.getValue('u_imei_string');
if (x) {
gr.setValue('name', x);
gr.update();
}
}
You could run that as a background script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 08:48 AM
Thank you Justin. It worked great!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2019 08:50 PM
That works beautifully!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2017 08:00 AM
Hi Carl,
Add a before insert/update business rule on Table "u_mobiles devices"
if (current.u_imei_string!='')
{
current.name = current.u_imei_string;
}
Please mark this response as correct or helpful if it assisted you with your question.