Client script dosn't work on workspace ITAM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello;
Hello i want to auto populate fields on asset form for the assigned to field ; but I have probléme on ITAM Workspace; My client script works on back office normaly but it dosn't working on ITAM Workspace!
Have anyone an idea about this problem please!
Thank you for answering me .
- Client script : on change
- function onChange(control, oldValue, newValue, isLoading, isTemplate) {
- if (isLoading || newValue === '') {
- return;
- }
- var ga1 = new GlideAjax('snowCsdmUtils');
- ga1.addParam('sysparm_name', 'getServiceFromUser');
- ga1.addParam('sysparm_userId', newValue);
- ga1.getXMLAnswer(function(response) {
- var result = response;
- g_form.setValue('u_service', result);
- });
- //----------
- var ga2 = new GlideAjax('snowCsdmUtils');
- ga2.addParam('sysparm_name', 'getDirectionFromUser');
- ga2.addParam('sysparm_userId', newValue);
- ga2.getXMLAnswer(function(response) {
- var result = response;
- g_form.setValue('u_direction', result);
- });
- //---------
- var ga3 = new GlideAjax('snowCsdmUtils');
- ga3.addParam('sysparm_name', 'getSirFromUser');
- ga3.addParam('sysparm_userId', newValue);
- ga3.getXMLAnswer(function(response) {
- var result = response;
- g_form.setValue('u_sir', result);
- });
- }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
so any reason to call 3 times the GlideAjax call?
Why not use single GlideAjax and return multiple values?
share your script include config screenshot
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello @Ankur Bawiskar because i want to populate 3 fields as you can see ( direction , service and another custopm field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
you can call GlideAjax only 1 time and script include will return all the 3 values in JSON and then you can parse and set your form fields
Now coming to your point why it's not working in workspace? share your script include config screenshot
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
37m ago
Hi @ahmed-24
1. Just set UI Type to "All".
Test it if not working then apply step 2
2. Combine your logic into one GlideAjax call using JSON.stringify (Server) and JSON.parse (Client). This is much faster and cleaner.
Happy to help!
To help others in the community find this solution, kindly mark this response as the Correct Answer and Helpful.
Warm Regards,
Deepak Sharma
Community Rising Star 2025