- 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 11:01 PM
Hi @Lon Landry4
There's a couple of things below you can give a try.
1. In your script include, you're using getValue while getting a record. So let's change this line below.
From
if (hardwareGr.getValue(firstAssetSysId))
To
if (hardwareGr.get(firstAssetSysId))
2. It should be an OnChange Client Script instead of OnSubmit for your case.
3. You may want to check the Auto-populate feature.
Auto-populate a variable based on a reference type variable (Utah)
Cheers,
Tai Vu