- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-03-2023 11:34 PM
I created an onchange Client Script on Configuration item field of incident table. Used GlideAjax and Script-Include.
The script include returns the company, manufacturer and the asset_tag value of the configuration item being selected.
But somehow it's returning undefined.
I tried using array, object and string as well to return the value from the script include but still the same result.
I even tried to match the sys_id instead of the name field.
I'm attatching the screenshots of Client script, script include and the output here.
Looking forward for the solution.
Thankyou.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2023 09:24 AM - edited 11-04-2023 09:26 AM
@moni170 Here is the source of your issue.
Please try updating your code as follows and see if it works for you.
cmdb: function() {
var obj = ‘’;
var ab = this.getParameter(‘sysparm_ci’);
var gr = new GlideRecord(‘cmdb_ci’);
gr.addQuery(‘sys_id’, ab);
gr.query();
if (gr.next()) {
obj = obj + gr.manufacturer.toString() + ',' + gr.company.toString() + ',' + gr.asset_tag.toString();
}
return obj;
}
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2023 11:19 AM
Hey @moni170 ,
you are missing .next() in script include. Please correct it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-04-2023 11:19 AM
Hey @moni170 ,
you are missing .next() in script include. Please correct it