cancel
Showing results for 
Search instead for 
Did you mean: 

start new workflow when one of the custom properties of existing document changed.

wayi
Champ in-the-making
Champ in-the-making

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.

2 REPLIES 2

douglascrp
World-Class Innovator
World-Class Innovator

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 

abhinavmishra14
World-Class Innovator
World-Class Innovator

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. 

~Abhinav
(ACSCE, AWS SAA, Azure Admin)