05-16-2017 12:48 PM
I'd like to send a notification mail to an user if it is created by the adminstrative user to the users email address.
05-16-2017 01:27 PM
There is no default functionality for this, but technically you could set up a rule on the people container node. This is not possible through the UI though. You could use content bootstrapping via a ImporterModuleComponent to load the rule set on Alfresco start. You would only have to create and export the rule set on another node (a folder where you can use the default UI) first. For exporting, you probably have to use the JavaScript Console to trigger the action since it is not exposed in the UI as well. JavaScript Console is also an alternative to using an ImporterModuleComponent to bootstrap / apply the rule set to the people container.
All in all you can see that it is possible though not one of the simpler customisations to apply to Alfresco.
05-17-2017 01:23 AM
Axels answer inspired me to another "inglorious workaround". You can also define a "onCreate" rule on the "User Homes" folder. This can be done via alfresco share.
This only works, if you are using the default user folder mechanism (flat style) and I don't know if it is working on background ldap-sync.
This also could cause problems if you are bulk syncing/creating users - so first test it...
For getting more logic in your rule, you could execute a rule-script. I provide just a snippet for some of your demands:
function sendMailTo(toAdr, subject, mailtext) {
var mail=actions.create("mail");
mail.parameters.to=toAdr;
mail.parameters.subject=subject;
mail.parameters.from=">your alfresco email address>";
mail.parameters.template=null;
mail.parameters.text=mailtext;
mail.execute(document);
}
function main() {
var owner=document.getOwner();
var userNode=people.getPerson(owner);
var mailAdr=userNode.properties.email;
var mailtext="Your useraccount was created.";
sendMail(mailAdr, "Alfresco Useraccount", mailtext);
}
main();
...Just hacked it together from snippets I used - you would have to adopt, test and improve it...
05-17-2017 03:56 AM
Nice hack.
Is it also possible to send user information (like: username, password, email-address)? i think username and email-address is not the problem but password? Or is alfresco planing an module that will do that for me ?
Thanks for your help
Regards
05-17-2017 04:11 AM
You could create an admin WebScript or an Aikau or Angular SPA (single page app) that creates the user, sets a random password and sends the email to the user. If your WebScript or SPA generates the password, it's also possible to send it via email. But you have to create the users with your (see above ) created admin tool.
if you're using alfresco 5.2 there is a simple REST API to create your user, including plaintext password. See: Alfresco Content Services REST API Explorer
but there should be an addon or something... wasn't there something created by ziaconsult?
05-17-2017 04:12 AM
You will not be able to send passwords either way since they have already been MD4 hashed by that point or may not exist at all (in case of sync from external directories). In order to send emails when local users are created AND include the password, you would need to hook yourself as an AOP interceptor on the (Mutable)AuthenticationService bean, though this would be sort of a non-standard customisation.
05-18-2017 01:38 AM
You could add all properties of the node (in this case userNode) that are returned by getPerson:
firstName, lastName, userName, email, organzationId, locale..
but not the password - see Axels answer.
10-15-2019 04:03 PM
Can I use the email template, which is in Repository > Data Dictionary > Email Templates > invite > new-user-email.html.ftl
If yes.
How can I do this?
Thanks
10-23-2019 07:41 AM
Yes. You can do it in the following way using javascript
mail.parameters.template = companyhome.childByNamePath("your template path");
Regards,
Vidhi
02-05-2020 07:08 AM
hello vidhipanchal i real need your help in customizing Alfresco Workflow. Would real appreciate if you give me your email so that you can give me some help. My email is georgejslugendo@gmail.com. Its urgent
Explore our Alfresco products with the links below. Use labels to filter content by product module.