cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to change the associated document dynamically

erangaj
Champ in-the-making
Champ in-the-making
Hi All,

Is it possible to change the associated document (associate another existing document instead of the original one) dynamically using javascript? If so how?

bpm_package.children[0]=anotherdoc;
doesn't work.

Thanks & Regards,
Eranga
3 REPLIES 3

schambon
Champ in-the-making
Champ in-the-making
In JavaScript I don't know, but I do that kind of thing in Java (at workflow startup I replace all package items with copies in a public space so all reviewers have access to the package items).

erangaj
Champ in-the-making
Champ in-the-making
Thanks a lot schambon

davidc
Star Contributor
Star Contributor
Two new Javascript methods were added in 2.1.

addNode(ScriptNode node) 

Adds an existing node as a child of this node.

removeNode(ScriptNode node) 

Removes all parent-child relationships between two nodes. The child node will be cascade deleted if one of the associations was the primary association, i.e. the one with which the child node was created.

You can use these to add and remove documents from the workflow package.

e.g.

bpm_package.removeNode(bpm_package.children[0]);
bpm_package.addNode(anotherNode);