
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 10:50 PM
HI Team,
I have written a onChange Client script on a catalog item as below:
The requirement is If the loggedin Person is having role as Supplier then we are firing this glideAjax and client script to check the company and thereby it should populate the Vendor Category.
Below is the Script include which is called via GlideAjax:
The issue is if you see gs.info('users are:'+user.getRowCount())
This is being printed multiple times.. I am not sure why?
Please assist in solving this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 11:03 PM
@Community Alums
Few things to check
1) your client script runs on change of vendor_category and you are setting the value again to same variable and hence it's causing multiple Ajax calls
2) why are you returning JSON string? simply return the array as this return arr.toString()
3) the table which you are querying with the company, is the field name "vendor" correct and is that field referring core_company table? what's the field type for that?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 11:03 PM
@Community Alums
Few things to check
1) your client script runs on change of vendor_category and you are setting the value again to same variable and hence it's causing multiple Ajax calls
2) why are you returning JSON string? simply return the array as this return arr.toString()
3) the table which you are querying with the company, is the field name "vendor" correct and is that field referring core_company table? what's the field type for that?
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 11:15 PM
Hi @Community Alums
Add the info logs below this.getParameter('sysparam_user') line and log the supplier variable, use the
var gUser = new Gliderecord('sys_user');
gUser.get(supplier);
if(gUser.company)
{
//add another glide record
}