Client script dosn't work on workspace ITAM

ahmed-24
Tera Contributor

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

ahmed24_0-1765965777567.png

 

 

  • 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);
  •     });
  •  
  • }
5 REPLIES 5

Najmuddin Mohd
Mega Sage

Hello @ahmed-24 ,

Create one more function in the Script Include, which will call internally three functions getServiceFromUser, getDirectionFromUser, getSirFromUser and store this in an array.

From the Client script, call this new function and get the array of these three values.
So, only one GlideAjax.


If the above information helps you, Kindly mark this as Helpful and Accept the solution.

Regards,
Najmuddin