How can I change 'creator' property in webscript in Alfresco of uploaded document?
I am using Alfresco 4.2, btw.
Best, D
If I'm not wrong cm:creator, cm:modifier, cm:created, cm:modified, etc...are auditable properties in Alfresco it means, can't be updated manually because are managed by Alfresco.
I have developed a java backed webscript and I have added this code (to update the creator and modifier properties) that is working properly:
// Disable auditable aspect to allow change properties of cm:auditable aspect
policyBehaviourFilter.disableBehaviour(nodeRef, ContentModel.ASPECT_AUDITABLE);
// Update properties of cm:auditable aspect
nodeService.setProperty(nodeRef, ContentModel.PROP_CREATOR, "xxxxxx");
nodeService.setProperty(nodeRef, ContentModel.PROP_MODIFIER, "xxxxxx");
// Enable auditable aspect
policyBehaviourFilter.enableBehaviour(nodeRef, ContentModel.ASPECT_AUDITABLE);
Don't forget to add in your context.xml file where you declare your beans:
<bean id="xxxxxxxx"
class="your class package"
parent="webscript">
<property name="nodeService" ref="NodeService" />
........
<property name="policyBehaviourFilter" ref="policyBehaviourFilter" />
</bean>
Good luck
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With