06-06-2019 12:39 AM
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.
06-28-2019 08:32 AM
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
06-28-2019 12:58 PM
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.
@Override
public 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.
Explore our Alfresco products with the links below. Use labels to filter content by product module.