Return Multiple Values from Script Include (JSON Object)

  Рет қаралды 2,825

TechWithPri

TechWithPri

Күн бұрын

Пікірлер: 20
@Kingboys9976_broo
@Kingboys9976_broo 10 ай бұрын
excellent .waiting for more use cases.
@techwithpri
@techwithpri 10 ай бұрын
New video is already uploaded go ahead and check it out 😁
@abhiramveeturi1956
@abhiramveeturi1956 3 ай бұрын
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?
@techwithpri
@techwithpri 3 ай бұрын
Hey 👋 Yes because it is an array type thats why it will return with comma 🤓
@Saiku_264
@Saiku_264 2 ай бұрын
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.
@Saiku_264
@Saiku_264 2 ай бұрын
I'm sorry I changed getParam to addParam but still I am not getting the output
@techwithpri
@techwithpri 2 ай бұрын
It seems all okay!! Try adding gs.log in script include and alert in client script to check where the value is missing !
@rohitdwivedi8195
@rohitdwivedi8195 7 ай бұрын
Please also give some info regarding debug for two ways in snow client and snow
@techwithpri
@techwithpri 7 ай бұрын
Hey !! Sure there would be videos on the same in my ServiceNow development series. Keep watching and keep learning 🤓
@chellamarudhupandianc3617
@chellamarudhupandianc3617 10 ай бұрын
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
@techwithpri
@techwithpri 10 ай бұрын
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
@chellamarudhupandianc3617 10 ай бұрын
thank you 🤩@@techwithpri . just to let you know your virtual agent class was brilliant . my team mates were impressed .
@techwithpri
@techwithpri 10 ай бұрын
@@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 😇!!
@DeepakkumarSing-n1z
@DeepakkumarSing-n1z 10 ай бұрын
@@chellamarudhupandianc3617I did the same mistake😃😃😃
@PavanKumarReddy-lu3qx
@PavanKumarReddy-lu3qx 4 ай бұрын
I'm getting same incidents for all the users, why it's happening like this?
@techwithpri
@techwithpri 4 ай бұрын
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.
3 Complex use cases of Script Include (Part 1)
15:35
TechWithPri
Рет қаралды 2,4 М.
Define a new Class Script Include (use case)
30:04
TechWithPri
Рет қаралды 3,6 М.
А что бы ты сделал? @LimbLossBoss
00:17
История одного вокалиста
Рет қаралды 11 МЛН
ЗНАЛИ? ТОЛЬКО ОАЭ 🤫
00:13
Сам себе сушист
Рет қаралды 3,4 МЛН
World’s strongest WOMAN vs regular GIRLS
00:56
A4
Рет қаралды 3,7 МЛН
GlideAjax - Client Callable Script Include
21:36
TechWithPri
Рет қаралды 4 М.
Proxy vs Reverse Proxy vs Load Balancer | Simply Explained
13:19
TechWorld with Nana
Рет қаралды 173 М.
You don't need NoSQL (use MySQL)
31:26
PlanetScale
Рет қаралды 75 М.
3 Use Cases of UI Actions
28:51
TechWithPri
Рет қаралды 3,4 М.
3 Complex use cases of Script Include (Part 2)
15:50
TechWithPri
Рет қаралды 1,6 М.
How to Check if a User Exists Among Billions! - 4 MUST Know Strategies
12:44
Learn JSON in 10 Minutes
12:00
Web Dev Simplified
Рет қаралды 3,2 МЛН