Workflow script fails depending on folder level

cancel
Showing results for 
Search instead for 
Did you mean: 
marcollirite
Active Member II

Workflow script fails depending on folder level

Jump to solution

Hi all

I'm trying to implement a script within my workflow definition which moves a file to a folder pre-selected by the workflow initiator. Currently, I have a cm:folder association called "vorwf_folderLink" and I am using the following code to move the file:

<script>      

      bpm_package.children[0].move(vorwf_folderLink.children[0].parent);

</script>

This works fine for higher-level folders, but if I select a folder which has no subfolders in it, I get the following error message:

Cannot read property "parent" from undefined

Can anyone explain why this error is appearing, or suggest an alternate method to achieve my goal?

1 Solution

Accepted Solutions
marcollirite
Active Member II

Re: Workflow script fails depending on folder level

Jump to solution

Solved it, simply as follows:

<script>      

      bpm_package.children[0].move(vorwf_folderLink);

</script>

View solution in original post

1 Reply
marcollirite
Active Member II

Re: Workflow script fails depending on folder level

Jump to solution

Solved it, simply as follows:

<script>      

      bpm_package.children[0].move(vorwf_folderLink);

</script>