Scoped application alternative to GlideRecordXMLSerializer()

ryanlitwiller
Giga Guru

Looking for an alternative to GlideRecordXMLSerializer() for a scoped application. Looking to get the entire XML of the glide record.

1 ACCEPTED SOLUTION

Brian Scott2
Tera Expert

Try this;

 

Create a script include under the global application that is accessible from all application scopes and paste this in as the script.

 

var ScopedXmlSerializer = Class.create();
ScopedXmlSerializer.prototype = {
initialize: function() {
},
serialize:function(currentRecord)
{
var xmlSerializer = new GlideRecordXMLSerializer();
return xmlSerializer.serialize(currentRecord);
},
type: 'ScopedXmlSerializer'
};

 

I tested in a background script and selected run script in scope <some scope that isn't global> with the following:

var current = new GlideRecord("sys_user");
current.setLimit(1);
current.query();
current.next();

var xml = new global.ScopedXmlSerializer();
var xmlString = xml.serialize(current);
gs.info(xmlString.toString());

View solution in original post

5 REPLIES 5

Bit of a work around but seems to be the best solution at this point.