cancel
Showing results for 
Search instead for 
Did you mean: 

Notify document's author of approval?

nullman
Champ in-the-making
Champ in-the-making
Hi all,

I am curious if this is possible with Alfresco:

A user has a PO Req (spreadsheet) they wish to have approved.

They drop it into /Operations/PO Reqs. An email notification is sent to the Operations Manager to let them know a document has been placed here for their review. (I understand how to do this.)

The Operations Manager approves the pending PO Req at which time it is moved to /Purchasing/Approved PO Reqs. An email notification is sent to the Purchasing Manager to let them know an approved PO Req has been placed here. (I understand how to do this.)

At this point I'd like to notify the document's author that their PO Req has been approved and is waiting to be purchased. I don't see any aspect for notifying the document's author. I don't want to email the whole company (or even a predefined list of users) when a PO Req is moved to the /Purchasing/Approved PO Reqs space, only the PO Req's author and Purchasing Manager.

Does that make sense? Would something like this require a custom Aspect? Is there a better way of doing something like this? I'd imagine there are other applications that could use this type of workflow feature, like Vacation Requests, etc.

Thanks,
Mike
9 REPLIES 9

rivetlogic
Champ on-the-rise
Champ on-the-rise
This could be done with a custom action.  For example, a custom action could be written that a) takes the author field from the content item, b) resolves the author to a username and associated email address, and c) emails the author an email using a pre-defined template.  The action could be invoked by any number of events, such as via a workflow step or via a condition defined within a normal rule.

–Mike

tna
Champ in-the-making
Champ in-the-making
I have run into the same problem: I was a bit surprised not to find "special users" like the "document author" or "last modifier" available as choices in rule definitions.
However…

This could be done with a custom action.  For example, a custom action could be written that a) takes the author field from the content item, b) resolves the author to a username and associated email address, and c) emails the author an email using a pre-defined template.  The action could be invoked by any number of events, such as via a workflow step or via a condition defined within a normal rule.
–Mike

I'd like to get a better idea of the amount of work this entails.

It seems to me that defining a new action would be the easiest way to acomplish the task, but it feels a bit hackish and not very scalable (how many actions would you define for misc. user roles in a document editing chain?): wouldn't "the right thing to do" be to extend the "Set Action Values" rule definition step?
This would fit in well with the semantics of the steps as they are now and also allow the user to select a notification template, the same way he would select it if he were notifying a specific user.
How complex would this be?

I ask because I might be tempted to contribute a bit of effort into the solution of the problem.

Tomislav

peterh_nl
Champ in-the-making
Champ in-the-making
This is basically the same problem as I run into on this thread: http://forums.alfresco.com/viewtopic.php?t=5699

Combining them the action would be a javascript that would extract the property-value and send the mail OR, and that seems a better and more usable way for common users (?), an extension/hack of the send mail action to select a  generic propertyvalue, containing a user or group, to send the mail to.

I will post my progress on the other issue since solving that will solve this too.. :wink:

melkor_kp
Champ in-the-making
Champ in-the-making
I am in that as well, if I discover something I will post it here.

frankr
Champ in-the-making
Champ in-the-making
I'm running as fast as I can to evaluate this product against our requirements.  I am initially very impressed.

But, I'm dying reading that there is not an easy, obvious, GUI-generated way to specify notification back to the Author when a document is approved.  Isn't that the most Basic requirement for most organizations?

It certainly is for ours.

peterh_nl
Champ in-the-making
Champ in-the-making
Hello Frank,

There seems to be a misunderstanding: basicly the kind of action you mention is available out of the box. More complex workflows require some form of customization. Alfresco offers a lot of possibilities on that aspect. This is a thread about what direction to chose and … how to learn from eachother doing that .. Smiley Happy
I think the others agree that Alfresco, even out of the box, is a great piece of work and all of us simple users are very happy with it, even when it's possibilities tend to challenge us to expand our knowledge more or less all the time. If we weren't we'd not be here discussing, and if we don't like to find out for ourselves we can always hire someone to make the customizations for us..
So don't let yourself be put off too easy, it's well worth the effort, at least that's my 2p on this one.
Having said this: anyone made a commencement on the subject?  :?:

jrbowker
Champ in-the-making
Champ in-the-making
There's an example of this in the adhock process definition. I believe it's out of the box in version 2.0, and can be found at tomcat/webapps/alfresco/WEB-INF/classes/alfresco/workflow/adhoc_processdefinition.xml

In case it's not in your installation, here's a copy:

<?xml version="1.0" encoding="UTF-8"?>

<process-definition xmlns="urn:jbpm.org:jpdl-3.1" name="wf:adhoc">

   <swimlane name="initiator"/>

   <start-state name="start">
      <task name="wf:submitAdhocTask" swimlane="initiator"/>
      <transition name="" to="adhoc"/>
   </start-state>

   <swimlane name="assignee">
      <assignment class="org.alfresco.repo.workflow.jbpm.AlfrescoAssignment">
         <actor>#{bpm_assignee}</actor>
      </assignment>
   </swimlane>

   <task-node name="adhoc">
      <task name="wf:adhocTask" swimlane="assignee">
              <event type="task-create">
                 <script>
                    if (bpm_workflowDueDate != void) taskInstance.dueDate = bpm_workflowDueDate;
                    if (bpm_workflowPriority != void) taskInstance.priority = bpm_workflowPriority;
                 </script>
              </event>
      </task>
      <transition name="" to="completed">
         <action class="org.alfresco.repo.workflow.jbpm.AlfrescoJavaScript">
           <script>
              if (wf_notifyMe)
              {
                 var mail = actions.create("mail");
                 mail.parameters.to = initiator.properties.email;
                 mail.parameters.subject = "Adhoc Task " + bpm_workflowDescription;
                 mail.parameters.from = bpm_assignee.properties.email;
                 mail.parameters.text = "It's done";
                 mail.execute(bpm_package);
              }
           </script>
         </action>
      </transition>
   </task-node>
   <task-node name="completed">
      <task name="wf:completedAdhocTask" swimlane="initiator"/>
      <transition name="" to="end"/>
   </task-node>

   <end-state name="end"/>


As you can see, "initiator" is associated with the person who started the workflow.

The wiki has <a href="http://wiki.alfresco.com/wiki/E-mail_Configuration">directions for configuring mail settings</a>.

The<a href="http://www.amazon.com/Alfresco-Enterprise-Content-Management-Implementation/dp/1904811116/ref=pd_bbs..."> Alfresco book</a> has information on email notices too, but I haven't read it. Perhaps someone else can comment on that.

davidc
Star Contributor
Star Contributor
The workflow definition posted here does indeed support the requirement of notifying the initiator, and with a slight adjustment, can notify the document author.

However, that is an advanced workflow.  I believe the initial discussion has been focused around simple workflow i.e. those that can be defined via the Web Client UI.

So, you have two choices:

a) Develop a Javascript Action that notifies the document author and plug it into the simple workflow mechansim
b) Use advanced workflow, where you can do whatever you like

b) is more difficult to implement.  It's advanced in two respects… 1) you can implement arbitrarily complex workflows with inbox support etc 2) it requires some low-level xml configuration to implement.

I hope that in versions to come, we can offer advanced workflows with the definition ease of simple workflows - it will just take time to get there.

darko_narandzic
Champ in-the-making
Champ in-the-making
Just for reference, i can provide you with sample code for a) simple workflow + javascript. Note that here I don't notify author of the document but the last user who modified it. I hope it will help.

var mail = actions.create("mail");
var modifier = people.getPerson(document.properties.modifier);
mail.parameters.to = modifier.properties.email;
mail.parameters.subject = "Subject text";
mail.parameters.from = "alfresco@alfrescodomain.com";
mail.parameters.template = companyhome.childByNamePath("Data Dictionary/Email Templates/YourEmailTemplate.ftl");
mail.parameters.text = "Email body text";
mail.execute(document);