cancel
Showing results for 
Search instead for 
Did you mean: 

adding metadata from an XML file to an aspect field

maninmadrid
Champ in-the-making
Champ in-the-making
I have an XML file which has tag data which I want to extract and use as a value for an aspect field. I'm familiar with Javascript and I have a rule which calls a server side .js file but when I try to use getElementsByTagname() it produces an error.

Failed to run Actions due to error: Failed to execute script 'workspace://SpacesStore/d2ca222d-00c2-11dc-abd3-d3625ca9de94': TypeError: Cannot find function getElementsByTagName. (AlfrescoScript#45)

My script looks like this: -

var videoGroup = document.content.getElementsByTagName("group");
document.properties["custom:VideoGroup"]  = videoGroup;
document.save();

Any ideas?
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
The Alfresco server-side JavaScript only supports pure ECMAScript i.e. not web-browser based javascript objects such as 'window' or 'alert' etc. The method you mention is part of the extended JavaScript API provided by web-browsers. You can only use pure javascript plus the Alfresco JavaScript API.

Thanks,

Kevin

maninmadrid
Champ in-the-making
Champ in-the-making
Thanks Kevin for the update.