cancel
Showing results for 
Search instead for 
Did you mean: 

[SOLVED]How to create and attach resource to workflow?

decoy
Champ in-the-making
Champ in-the-making
I need to make a new document and attach it to currently running workflow. So far i made a file and placed it to Some Folder. In next step of workflow i don't see that this file is attached to workflow. I've been trying to attach this file to wf, but with no success.  The code is shown bellow

      <transition to="" name="test">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
                    <script> 
                         var dest = companyhome.childByNamePath("User Homes");                
                  var file = dest.createFile("file_name");
                  file.save();  
                 </script>
                  </action>   
      </transition>

I've searched this forum but with no succes. Does anyone knows how to implement this?
5 REPLIES 5

mrogers
Star Contributor
Star Contributor
You could take a look at the implementation of this page -> http://wiki.alfresco.com/w/images/7/77/Bpm_start_workflow.jpg

In rough terms you will need to add the node-ref of your new document to the "workflow package"

decoy
Champ in-the-making
Champ in-the-making
I found solution for my problem. The solution is in script bellow

<script>
var dest = companyhome.childByNamePath("User Homes");
var file = dest.createFile("file_name.txt");
file.content="test content";
file.save();
bpm_package.addNode(file);
</script>

golden_eye
Champ in-the-making
Champ in-the-making
Hi i have a similar problem,workflow is working fine,except the person who was assiged to approve the document,can't see the document and metadata.
When i assigned person to approve document,they always get under resource the name of file and path where the file is saved.
Now for some reason i am getting No resource found?
Some one with the same issue?

norgan
Champ in-the-making
Champ in-the-making
Sounds like a RIGHTS problem. Documents,you have no rights to, are not found, "document" or "space" root object for instance may be void/null, when you do not have the rights.

golden_eye
Champ in-the-making
Champ in-the-making
Yes,it is right.
Me stupid how could i missed that. :shock:
Thank.