onChange Client Script - Incident Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 12:20 AM
I am trying to fill a field on incident form based on change on configuration item using the code below. It is not working. Also when I checked, the data is from this table cmdb_ci_business_app since the category selected for the incident is business apps. Please help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 03:32 AM
Try using callback function:
if (g_form.getValue('cmdb_ci') != '') {
var citem = g_form.getReference('cmdb_ci', setNewValue);
function setNewValue(citem) {
g_form.setValue('u_ado_project', citem.x_adbad_app_cr_ado_project);
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 05:20 PM
Hi,
I tried callback but it is still not working. Here is my revised code:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-14-2023 05:47 PM
I further modified the setValue part. See below. The target field was set to "undefined".
g_form.setValue('u_ado_project',ci.x_adbad_app_cr_ado_project);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-15-2023 03:38 AM
That's what you'll get when the field name that you supply doesn't exist on the referenced table, cmdb_ci in this case.