As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
I need to start new workflow when one of the custom properties of existing document is changed.
Is there any way to execute server-side javascript when editing metadata and how I can get which property changed.
Hello.
If I were you, I would create a custom behaviour, just like described in the following tutorial: Implementing Custom Behaviors in Alfresco | ECMArchitect | Alfresco Developer Tutorials
It will not be appropriate to trigger the workflow from server side js as you will also require to compare the previous and new value for the properties/property. I would suggest to implement a behavior by implementing org.alfresco.repo.node.NodeServicePolicies.OnUpdatePropertiesPolicy interface.
This policy provide a method where you can easily compare old and new value on a property.
@Overridepublic void onUpdateProperties(final NodeRef nodeRef, final Map<QName, Serializable> before, final Map<QName, Serializable> after) {
....
}
In the above implementation you can add your code to trigger the workflow on value change.