cancel
Showing results for 
Search instead for 
Did you mean: 

Simple Work Flow - Email notification to documents owner

lordlaw
Champ in-the-making
Champ in-the-making
Hi,

i had try the simple work flow from the manual.
it did a great job and i able to make it works.

but i want to have a features to be implemented in that flow.
currently is that, the content rule can be set in a particular space to send email to notify some users about the changes happen in the space. which is constantly notify the same person whenever a document come into the space. like what had been show in the simple work flow example.

what i mean here is, i want a email notification to the document owner.
for example, A1 had submitted a document to space A, an email had been sent to notify B1 about new document come into space A, then B1 approve the document. start from here, i cannot find a way to notify A1 about his document been approved. i cannot apply the email rules into the space because there will be C1, D1 etc to submit the document to be approved.

i found a similiar post
http://forums.alfresco.com/en/viewtopic.php?f=34&t=18466&p=60719&hilit=email#p60719

any idea to implement this currently ??


Thanks,
Lawrence
1 REPLY 1

cheffilet
Champ in-the-making
Champ in-the-making
I can not find any "simple workflow" being called as such a one.
But i think something like following should help to guide you along the problem:

Your problem is to fetch the document owner of a document?
Firstly you must get the documents being added to the workflow. This could work like following:

workflowInstance = workflowService.getWorkflowById("xyz");

NodeRef pathToAllAddedDocuments = workflowInstance.workflowPackage;

for(ChildAssociationRef ref : nodeService.getChildAssocs(pathToAllAddedDocuments )){
    NodeRef child = ref.getChildRef();
    String owner=nodeService.getProperty(child, ContentModel.PROP_OWNER);
   //TODO: ADD your code here
}

Now you can get the email from this user via PersonService or what you want to do with it.


Now you have to add some logic to your workflow. As decsriped above i do not know about this workflow so i write down some helpfuly code:


<task-node name="task-B1">
  …
  <task>
  …
   </task>
    <transition name="approve" to="approve" />
    <transition name="reject" to="reject">
</task-node>

<task-node name="approve">
  <event type="node-enter">
     //this class has the logic of the above descriped code.
     <action class="de.dmc.NotifyDocumentOwnerAction"/>
  </event>
</task-node>


Best Regards