- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 07:13 PM
I have an onSubmit catalog client script & script includes. I am trying to populate the State (install_status) with asset matching a catalog variable. I have checked like posts but the solutions have not worked for me.
Script includes (client callable is true, Accessible from All application scopes)
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 07:45 PM
@Lon Landry4 Please update your script include script as follows and you will start getting the data on the client side.
var PopulateFirstState = Class.create();
PopulateFirstState.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getInstallStatus: function () {
// Get the sys_id parameter from the client-side
var firstAssetSysId = this.getParameter('sysparm_first_asset_returning_sys_id');
// Query the alm_hardware table to get the install_status value
var hardwareGr = new GlideRecord('alm_hardware');
if (hardwareGr.get(firstAssetSysId)) { //Used get instead of getValue();
var InstallStatus = hardwareGr.getValue('install_status');
return InstallStatus;
}
}
});
Hope this helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 07:45 PM
@Lon Landry4 Please update your script include script as follows and you will start getting the data on the client side.
var PopulateFirstState = Class.create();
PopulateFirstState.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getInstallStatus: function () {
// Get the sys_id parameter from the client-side
var firstAssetSysId = this.getParameter('sysparm_first_asset_returning_sys_id');
// Query the alm_hardware table to get the install_status value
var hardwareGr = new GlideRecord('alm_hardware');
if (hardwareGr.get(firstAssetSysId)) { //Used get instead of getValue();
var InstallStatus = hardwareGr.getValue('install_status');
return InstallStatus;
}
}
});
Hope this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-25-2024 12:46 AM
Thanks Sandeep! I am also using this as a training tool, as I learn to write my own script includes (when one is not available). I changed to an onChange client script due to issues mentioned by other.
-Lon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 08:14 PM
Good day !!
This is not good practise to using the onSubmit client script with GlideAjax.
Kindly check this articles for your reference.
https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0783579
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2024 08:37 PM - edited 01-24-2024 08:37 PM
Hi @Lon Landry4
If you want to call a script include from an on submit client script , it must be a Synchronous call using getXMLWait instead of getXML, otherwise the Catalog item will be submitted before you get a response from the script include.
For Service Portal getXMLWait is not supported. You can refer below articles and configure your script include and client accordingly to make it work across Native/Service Portal view:
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.