Hello,
I have 2 workspaces A and B. Both have items that exist in the DB, and are associated through the Relationships tab (bi-directional).
I would like to write a script so that when the item in WS B is set to 'Closed', the related item in WS A is set to Closed as well. I have found the script that allows for 'performWorkflowTransitionBy', but I have only been able to use it when creating new items, and I would like to use it in an existing item, and driving the linkage thru the Relationships tab.
Could you please provide any guidance? (maybe I am not understanding how the Relationships are called on the script reference).
Thanks!
Solved! Go to Solution.
Solved by tony.mandatori. Go to Solution.
I have done something similar with automatically pushing workflows forward, but not on related items.
You should be able to advance the related items as follows:
for (var i=1;item.relationships.length; i++) { relatedItem = item.relationships[i-1].item; relatedItem.performWorkflowTransitionByCustomID('AUTONOTIFY', 'Automatically notified since created from a CO') }
Be sure to add some conditional statements to check if the item should be moved forward and that the item is in the expected state.
Hope that helps.
Thanks Tony! Will test and let you know if we run into any issues. I was on the wrong path on how to call relationships.