cancel
Showing results for 
Search instead for 
Did you mean: 

Remove non existing aspect from node

ceeliro
Champ in-the-making
Champ in-the-making
Hi All,

I am trying to run a batch in the Share JavaScript console that removes an specific aspect applied to some nodes. The problem is that the aspect is a custom aspect and doesn't exist anymore in our last release

Example


var def =
{
  query: "@name:283.JPG",
  store: "workspace://SpacesStore"
};
var results = search.query(def);
for each(var node in results) {
     logger.log(node.name + " (" + node.typeShort + "): " + node.nodeRef);
     if(node.hasAspect("icmr:protectedContent")) {
          logger.log("Removing aspect");
        node.removeAspect("icmr:protectedContent");
   }
}


The error


500 Internal Error
An error inside the HTTP server which prevented it from fulfilling the request.
08190051 Wrapped Exception (with status template): 08190009 Failed to execute script 'Javascript Console Script': Class {http://www.alfresco.org/model/icmr/1.0}protectedContent has not been defined in the data dictionary


Any suggestion on how to achieve this?
Thanks in advance
2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
You need to add that aspect and deploy again.Then run that script to remove all aspects.

ceeliro
Champ in-the-making
Champ in-the-making
Thanks, exactly what i did…