- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 07:29 AM - edited 02-13-2025 07:33 AM
I'm attempting to create a fix script that will populate two new fields on the incident form for all existing incidents. The two fields (asset tag and serial number) are both dependent on the value of the Configuration item field. With the newly created onChange Client script these two new fields will auto populate with their respective values from the asset chosen in the Configuration item. Below is what I have so far that is not working. Can anyone provide some insight? Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 07:32 AM
Your GlideRecord is instantiated as grIncident, but you are using gr. in the while loop. Change all of these appearances to grIncident, and you should be closer.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 08:00 AM
Wow, it was emptying the value of those new fields on incidents whose configuration item was not an asset then it populated the new fields for only those incidents who's config item was an asset. That was so cool! Thanks for your assistance gents.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 07:35 AM
@JamesT-1 ,Your gliderecord object is "grIncident " and you are using "gr".
Please mark correct/helpful if my response helped you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2025 07:38 AM
Hello @JamesT-1 ,
Please try the below script
var grIncident = new GlideRecord('incident');
grIncident.query();
while (grIncident.next()) {
grIncident.u_inc_asset_tag = grIncident.cmdb_ci.asset_tag;
grIncident.u_inc_serial_number = grIncident.cmdb_ci.serial_number;
grIncident.setWorkflow(false);
grIncident.update();
}
the issue with your script was you have initializes the Gliderecord object as "grIncident" but mistekely you have done
Kindly mark it as accepted/helpful if this helps you.
Regards,
Debasis