- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 07:46 AM
There are two variables on my catalog item: one for "Requested For" and another one is an "Asset" variable (List Collector, table reference: asset table). Once the "Requested For" is selected, the "Assigned Asset" of this "Requested For" will be auto-populated in the "Asset" field. Here is the code, but it's not working. Please review for any mistakes:
Script Include:
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 08:44 AM
Requiremnt:Once the "Requested For" is selected, the "Assigned Asset" of this "Requested For" will be auto-populated in the "Asset" field
Solution: In order to Auto-poulate the asset field, you need to use an onChange Client script on "Requested For". Inside this script, you need to make a GlideAjax call (Make sure that GetAssetDetails is a client callable script include, currently it is server side script include as it is not extended from Object.extendsObject(AbstractAjaxProcessor). In the responseCallback you need to assign the sys_ids returned from the script include.
In your current implantation you are using a reference qualifier which acts as a filter when you try to chose records from the field but doesn't auto populate the values for you.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 08:03 AM - edited 06-11-2024 08:04 AM
Do you know if you are getting your value back to your client script? I would start with adding log statements to between line 12 and 13, with <gs.info('example text ' + asset.join(','))> and confirm that you are returning the value you want. If you are, then it may be an issue of how you are setting the value in the client script, which you can use < alert(value)> to see what you have on the client side.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 08:44 AM
Requiremnt:Once the "Requested For" is selected, the "Assigned Asset" of this "Requested For" will be auto-populated in the "Asset" field
Solution: In order to Auto-poulate the asset field, you need to use an onChange Client script on "Requested For". Inside this script, you need to make a GlideAjax call (Make sure that GetAssetDetails is a client callable script include, currently it is server side script include as it is not extended from Object.extendsObject(AbstractAjaxProcessor). In the responseCallback you need to assign the sys_ids returned from the script include.
In your current implantation you are using a reference qualifier which acts as a filter when you try to chose records from the field but doesn't auto populate the values for you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2024 09:52 AM
The requirement needs to be completed using the reference qualifier and script include, not by an onChange client script. That's why I'm using a reference qualifier. I have already completed this requirement using a client script.