cancel
Showing results for 
Search instead for 
Did you mean: 

Sending Email to Owner of document

senthil_chinnai
Champ in-the-making
Champ in-the-making
Hi All:

I am configuring Advanced Workflow to notify users in various stages. I could successfully do it between initiator <==> reviewer, but I would like to send email to the owner of the content once the task is done.

I don't know how to get the owner's email id in process definition file.

Please note in our workflow process, initiator and owner of document are different.

Please help !

Thanks,
Senthil.
2 REPLIES 2

blackout
Champ in-the-making
Champ in-the-making
Assumed that the "owner" you're talking about is the "creator" (as you can see in the Document Details page), it can be simply retrived with this code:
var ownerGuy = bpm_package.children[0].properties.creator;
You can after use this string to get the user itself in this way:
var ownerMail = people.getPerson(ownerGuy).properties["cm:email"];
By what you previously wrote, I think you can send an email within a script, so no more code needed.

Note that the "author" is different from the "creator": the creator is the person who created the Node representing the document in the Alfresco repository, and is obviously an Alfresco user; the author is instead a random person who created the file itself that is not an Alfresco user in most of the cases (i.e. if the document is "La Divina Commedia" I doubt you'll find Dante's email address Smiley Very Happy).

Hope it helps

P.S.: I personally tested the first line of code, didn't try the second because mail server is down at the moment Smiley Very Happy

senthil_chinnai
Champ in-the-making
Champ in-the-making
Wow ! What a magic ! It works as expected. Thanks a bunch Blackout !

Senthil.