- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 04:26 AM
I have two reference fields on a form. one is platform and second one is CMDB. platform field is getting data from data management table and CMDB is getting data from cmdb_ci table. data management table having a list field which is reference to CMDB. when CMDB field is filled, the platform which is linked to that same ci to be auto populated in first reference field. how can i do that.
Thanks in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 08:33 AM
Hi @Kumar147 ,
You can set these fields using an onChange client script with the "Configuration item" (cmdb_ci) as the field name.
The following code is just an example of how you can retrieve data from the CI and populate the incident table using getReference:
function onChange(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; } var ci = g_form.getReference("cmdb_ci", callBack); } function callBack(ci){ if (ci) { var cusSysId = ci.assigned_to; //assigned to user on the ci record var locSysId = ci.location; //ci location g_form.setValue("caller_id", cusSysId); //set caller with the user assigned to the ci g_form.setValue("location", locSysId); //set location based on ci location } }
I personally prefer GlideAjax which has a client and server requirement to work. The benefit of using GlideAjax is that it only returns the data that you need rather than the whole record.
If you find it helpful, please mark my answer as correct so that it can useful to others.
Thanks & Regards,
Sumanth Meda

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 07:45 AM
Use getReference in a onChange client script for the CI field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-24-2024 08:33 AM
Hi @Kumar147 ,
You can set these fields using an onChange client script with the "Configuration item" (cmdb_ci) as the field name.
The following code is just an example of how you can retrieve data from the CI and populate the incident table using getReference:
function onChange(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; } var ci = g_form.getReference("cmdb_ci", callBack); } function callBack(ci){ if (ci) { var cusSysId = ci.assigned_to; //assigned to user on the ci record var locSysId = ci.location; //ci location g_form.setValue("caller_id", cusSysId); //set caller with the user assigned to the ci g_form.setValue("location", locSysId); //set location based on ci location } }
I personally prefer GlideAjax which has a client and server requirement to work. The benefit of using GlideAjax is that it only returns the data that you need rather than the whole record.
If you find it helpful, please mark my answer as correct so that it can useful to others.
Thanks & Regards,
Sumanth Meda
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2024 05:35 AM
Hello Sumanth,
Actually i want to limit the number of records displayed in reference qualifier using script include.