cancel
Showing results for 
Search instead for 
Did you mean: 

Bulk update of a property

pedwards99
Star Contributor
Star Contributor

Hi there,

Does anyone know of an easy way to bulk update a property on lots of documents?

The situation I have is that a new property has been added to our content model. We need to set the default value of all existing content that has been affected by this update. 

Normally I would write a bit of JS to find all the documents, then iterate through each setting the property.

But here's the catch...the system has quite a lot of folder rules and behaviour policy extensions associated to my content types. If I just run my JS, it will trigger these rules and behaviour policies. I need a way of updating the property without any of this happening.

Any ideas?

Thanks

Paul

5 REPLIES 5

jpotts
World-Class Innovator
World-Class Innovator

If you want to bulk update a property on a lot of documents you can either write a script to iterate over the docs or you can use CMIS, because CMIS 1.1 supports bulk operations against collections of objects.

You are also asking about making updates without triggering behaviors. If you want to do that, you can. I can't recall if the JavaScript API supports it, but the Java API does. Take a look at the JavaDoc for BehaviourFilter.

Thanks Jeff,

I'll take a look at the Java API docs.

Paul

Sent from my iPhone

Hi Jeff,

Just to clarify, if I write my "property update" program as a standalone CMIS application - I'm not going to be able to disable behaviours? To do that, i need to use the Java API which means implementing something like a java-backed web script that I deploy to alfresco and then call ? Or did I miss something here?

Thanks

Paul

douglascrp
World-Class Innovator
World-Class Innovator

It is possible to disable the folder rules and the behaviours using Javascript and the js-console addon.

You can find a sample code for behaviours at Disable alfresco policy in Javascript.js · GitHub 

For the folder rules, you can use a similar approach, with something like this How to enable/disable Alfresco folder rules using JavaScript · GitHub 

Thanks Douglas, that's really useful to know.

Paul