EmailBean not working in activiti community edition

cancel
Showing results for 
Search instead for 
Did you mean: 
xelcina5
Member II

EmailBean not working in activiti community edition

Hello everyone, when I first installed licensed verison of alfresco activiti ( enterprise edition ) , I was able to send emails with my process so it works just fine there, but when I imported the same process on the activiti community edition I get the following error:

Caused by: javax.el.PropertyNotFoundException: Cannot resolve identifier 'emailBean'
at de.odysseus.el.tree.impl.ast.AstIdentifier.eval(AstIdentifier.java:93)
at de.odysseus.el.tree.impl.ast.AstMethod.eval(AstMethod.java:77)
at de.odysseus.el.tree.impl.ast.AstMethod.eval(AstMethod.java:100)
at de.odysseus.el.tree.impl.ast.AstEval.eval(AstEval.java:51)
at de.odysseus.el.tree.impl.ast.AstNode.getValue(AstNode.java:31)
at de.odysseus.el.TreeValueExpression.getValue(TreeValueExpression.java:122)
at org.activiti.engine.impl.delegate.invocation.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
at org.activiti.engine.impl.delegate.invocation.DelegateInvocation.proceed(DelegateInvocation.java:35)
at org.activiti.engine.impl.delegate.invocation.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:49)
... 103 more

My process looks like this:

It is very simple and just checks if an email can be sent. I have also configured email server in activiti-app.properties file but it seems that community edition does not have all the beans like enterprise edition.

My expression: 

${emailBean.getProcessInitiator(execution)}

I think that my beans are not configured, so can anyone tell me how should I configure my beans to work with expressions in activiti processes.
I have an attachment of my process (test3.bpmn20.xml) and it's just for testing email bean.


Thanks in advance! 

3 Replies
ryandawson
Alfresco Employee

Re: EmailBean not working in activiti community edition

That emailBean isn't a user-defined bean, it's a feature specific to the enterprise edition - see the comparison table at the bottom of Alfresco Process Services (BPM) powered by Activiti | Alfresco  and search for 'email'. You could create your own spring bean and annotate it with @Component("emailBean"). You'd want to have a getProcessInitiator method that can take a DelegateExecution as a parameter. You'd then need to look up the initiator's userId. Or in your case it looks like the initiator would also be the current user so that's another route. I think the initiator is stored in a variable and the variable name is added to the startEvent's initiator property when the process model is created so if you could find that you could get it off the execution. You'll then need to find the email address from the IdentityService (which you could autowire in). An example of sending emails with community edition is at hasCode.com » Blog Archive » Business Process Modeling with Activiti and BPMN 2.0  - in that example the email is obtained from the form but one of the comments suggests another path for getting the email. Naturally the enterprise edition makes it easier to do this - I'm explaining the other paths as I assume you're not in a position to use enterprise.

xelcina5
Member II

Re: EmailBean not working in activiti community edition

Hi Ryan Dawson, thank you for your response, I'm beginner with activitivi, can u show me how to create my own bean and how to execute IdentityService? I would be very thankful if u can help me somehow.

ryandawson
Alfresco Employee

Re: EmailBean not working in activiti community edition

Spring beans in Activiti community are not very different from enterprise - Spring Beans | Alfresco Documentation . I don't think you need to do much with IdentityService other than wire it in and use it to look up the user. If you're not yet comfortable with writing delegates using spring beans then you're probably best to look at some examples - maybe start by having a look at the articles at Articles and Blogs on Activiti · Activiti/Activiti Wiki · GitHub .