XMLHelper in GlideAjax

Sean Duhaime
Giga Contributor

Hello everyone,

I am aware of how to use GlideAjax to return JSON, but for my own knowledge I am working on building out the same scripts just returning XML strings.   In my client script I need to convert that string to an object so that I can perform some action with it.   I found a Script Include in SN called XMLHelper that has a method called toObject() that does this.  

Unfortunately I am not having any success with it.   I wasn't sure if this Script Include could only be accessed server-side (I noticed that OOB in my PDI the "Client Callable" checklist is unchecked.   Just for fun I checked it and tried to call that method in my GlideAjax client script, to no success.  

Am I going about this all wrong?   Is XMLHelper not intended to be called by a client?   Is XMLHelper deprecated?

Thanks

1 ACCEPTED SOLUTION

Hi Sean,



Ok got it. But in ideal case you should parse the xmlstring in serverside. You can refer below links where they say they have done parsing in client side.



XML Client side?


Parse XML using JavaScript - Stack Overflow



If this helps to solve your query then please mark the answer as correct and also mark it as helpful.


Thanks in advance



Regards


Ankur


Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Ok Sean,



Could you also mark the answer as helpful and hit like. Thanks in advance



Regards


Ankur


Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader