XML Parse example (on ecc queue table)

var grECCQ=new GlideRecord('ecc_queue');

//var sysid='8929f7ec4fed2700ddd0ecd18110c765';
sysid='2d616f684f2d2700ddd0ecd18110c71c';
if (grECCQ.get('sys_id', sysid)){

   var pl_xml=new XMLDocument(grECCQ.payload);

var inodes= pl_xml.getNodes("//parameter");

for (x=0;x<inodes.length;x++){
//gs.print(inodes.item(x).getAttribute('name') + '::: ' + inodes.item(x).getAttribute('value'));
var sname=inodes.item(x).getAttribute('name');

//if (sname=='sequence'){
if (sname=='error_string'){
   sValue=inodes.item(x).getAttribute('value');
  gs.print('sValue=' + sValue);
   if (sValue!=''){
        gs.print('ERR!!');
   }
}
}

var sErrChk2=pl_xml.getNodeText("//error");
gs.print(sErrChk2);
}

Comments

Popular posts from this blog

Running transform maps asynchronously

Post a command to the ECC queue for the mid server to initiate a powershell file copy

GlideRecord setValue