I am trying to automatically create a new record in a different workspace and add all the workflow items from the current record to the new record.
I can create a new record and fill in the basic information, but I cannot get it to copy over the workfow items.
I have tried different methods with no luck. This is what I have now.
// Add all affected items in Change Order to Review Record
for (var i in item.workflowItems) {
var additemid = item.workflowItems[i].id;
var linked_item = loadItem(additemid);
newItem.workflowItems.addItem(linked_item); <<< line 29
}
everything works well until the last line
the linked_item variable look good.
Thanks,
Sten
Error message:
[COcreateNewReviewRecord (line 29, col 0)] org.mozilla.javascript.WrappedException: Wrapped java.lang.NullPointerException (COcreateNewReviewRecord#29)
Solved! Go to Solution.
Solved by gasevsm. Go to Solution.
Sten, we are presently discussing a scripting engine model where this manipulation with newly spawned items can be done in the same single script that made the spawning (eg. adding it to other spawned/existing items' tabs as well as adding other spawned/existing items to its tabs). I have no expections to set or timeline to share with this forum just yet; we just started noodling on the concept overall. I am convinced this would address your needs, if or when it becomes available.
Regards,
Hi Martin,
I've having trouble with this same issue but it is my understanding that the script engine can now handle chaining. I have done this successfully with things like copying items from related items tab to a newly spawned item, but I am currently having trouble getting the workflowItems.addItem to work on a freshly spawned item. Are workflowItems excluded from the script chaining functionality?