In the output for the list incidents raised by caller all are seperated by comma(,). Can you please let me know is there a way to remove it (,)while printing the output?
Hii Pritam, I am getting like this at the top of client script "New client-scripts are run in strict mode, with direct DOM access disabled. Access to jQuery, prototype and the window object are likewise disabled. To disable this on a per-script basis, configure this form and add the "Isolate script" field. To disable this feature for all new globally-scoped client-side scripts set the system property "glide.script.block.client.globals" to false. " Will this affect the output? and also here is my code for script include: getINC: function(){ var incArray=[]; var gr=new GlideRecord("incident"); gr.addQuery("caller_id",this.getParameter("sysparm_user_id")); gr.query(); while(gr.next()){ var incDetails={}; incDetails.number=gr.number.toString(); incDetails.priority=gr.priority.getDisplayValue(); incDetails.short_desc=gr.short_description.toString(); incArray.push(incDetails); } return JSON.stringify(incArray); }, for client script var finalArray = []; var ga = new GlideAjax("demo"); ga.getParam("sysparm_name", getINC); ga.getParam("sysparm_user_id", g_form.getValue("caller_id")); ga.getXMLAnswer(INCdetail); function INCdetail(response) { var obj = JSON.parse(response); for (var i = 0; i < obj.length; i++) { finalArray.push(obj[i].number + " " + obj[i].priority + " " + obj[i].short_desc + " " ); } g_from.setValue("description",finalArray); } Please let me know if there is any error as I am not getting the result.
Hey 👋 There must be something wrong in the code itself, check twice. If that does not solve the problem.. Send me the code here so that I can check from my end.
im getting this error when changing the username "onChange script error: TypeError: Cannot read properties of undefined (reading 'apply') function () { [native code] }" My Script include is as follows : var getIncDetails = Class.create(); getIncDetails.prototype = Object.extendsObject(AbstractAjaxProcessor, { getInc: function() { var incArray = []; var gr = new GlideRecord('incident'); gr.addQuery('caller_id', this.getParameter('sysparm_user_id')); gr.query(); while (gr.next()) { var incDetails = {}; incDetails.number = gr.number.toString(); incDetails.priority = gr.priority.getDisplayValue(); incDetails.short_desc = gr.short_description.toString(); incArray.push(incDetails); } return JSON.stringify(incArray); }, type: 'getIncDetails' }); My onChange client script is as follows : function onChange(control, oldValue, newValue, isLoading, isTemplate) { if (isLoading || newValue === '') { return; } var finalArray = []; var ga = GlideAjax('getIncDetails'); ga.addParam('sysparm_name', 'getInc'); ga.addParam('sysparm_user_id', g_form.getValue('caller_id')); ga.getXMLAnswer(IncDetail); function IncDetail(response){ var obj = JSON.parse(response); for( i=o; i
Hey!! Thanks for asking!! What I can see is in the On Change Client Script you did not mention the keyword 'new' while declaring the GlideAjax object. It should be var ga = New GlideAjax('getIncDetails'); Let me know if you still getting the error.
@@chellamarudhupandianc3617 The pleasure is all mine !! 😃 Ask them to share with more people so that It can reach out to many people. And here goes some good news, the part 2 of the Virtual Agent Series is coming very soon. Where we will deal with complex use cases and advance things. And there would be lot of things for the members. Keep watching and keep learning 😇!!