-
1. Re: How send mail to "starter" user
swiderski.maciej Apr 14, 2010 2:46 PM (in response to marc.carrio)1 of 1 people found this helpfulHi,
it depends on how do you start your process.
I assume that you use jbpm console at the moment?! If so by default console will not save name of the user who starts the process.
What I could suggest to try is to use form for starting and try to capture user name from request object as principal. Have not tried it my self but could be a one way to do it.
Cheers
Maciej
-
2. Re: How send mail to "starter" user
rebody Apr 14, 2010 9:08 PM (in response to marc.carrio)1 of 1 people found this helpfulHi Mary,
The easiest way is use process variable to store the starter of a process instance, Then you could use a event-listener to send a mail. It is strange that jBPM didn't store the starter of a process instance. so if you want to know the starter's process instances, you have to create a new table and do some extension.
-
3. Re: How send mail to "starter" user
marc.carrio Apr 15, 2010 3:31 AM (in response to marc.carrio)Thanks a lot for your answers guys!
But the question is... Can I do it without java code? only with forms (.flt) and processdefinition (jpdl.xml)?
My idea is in the starter form put any variable seems:
<input type="hidden" name="startUser" text=$getCurrentUser />$getCurrentUser -> is the function/expresion that I'm searching.
And in the process definiton notification task put:
<mail g="166,258,115,45" language="juel" name="Mail">
<to addresses=$startUser/>
<subject>Task finished</subject>
<text>The task that you start are finished!</text>
<transition to="end"/>
</mail>It is Science fiction? or you think that i can do anything?
Thanks for advance for your help!!
-
4. Re: How send mail to "starter" user
sebastian.s Apr 15, 2010 3:01 PM (in response to marc.carrio)AFAIK it's not possible to do it the way you want it do because the console has no way to pass the authenciated user in the console to the engine. This was on the roadmap to be addressed in the future but development is a bit stuck right now. I know this for sure for jBPM 4.x. I am not sure about jBPM 3.2 I have to say.
-
6. Re: How send mail to "starter" user
swiderski.maciej Apr 15, 2010 3:16 PM (in response to sebastian.s)Hi,
I have created jira issue for BPMC project (just to have it in the right place).
I did already implementation for that so user name is stored as process variable automatically and transparently (so to say to the initiator of the process).
https://jira.jboss.org/jira/browse/BPMC-65
Please vote for it, this could help to prioritize it and hopefully will be included in the next release of the console.
Cheers,
Maciej
-
7. Re: How send mail to "starter" user
sebastian.s Apr 15, 2010 3:41 PM (in response to swiderski.maciej)It's more an issue of jBPM than of the console. But you're right the console would need a change, too. However jBPM's API is even already prepared if you take a look at the javadocs.
http://docs.jboss.org/jbpm/v4/javadocs/org/jbpm/api/ProcessEngine.html
Take a look at the method called setAuthenticatedUserId(java.lang.String authenticatedUserId
1. the console has knowledge of the authenciated user (he had to authenciate to access the console)
2. the console needs to call this method each time the user invokes a method on the API (like starting a process) to pass on the information
3. jBPM needs to store the information somewhere (maybe in a process variable but rather not) to expose it to the process and user
IMHO it should be stored in the history data together with the information about the start event and it should be queryable via the API.
It could be exposed via the execution context to the process.
The issue is more or less an issue bothering people who use the included console. People using their own GUIs just store the name of the process starter in a process variable and use this variable later on - for example to do calucations, assign a task to him or just refer to him. Setting the starter via the API would be cleaner.
The issue (https://jira.jboss.org/jira/browse/JBPM-2482) mentions the place in the source code which is affected. Whenever a new process instance is created the supplied user needs to be stored somewhere. Right now the code is not dealing with the supplied user name.
This issue is related or almost the same. I think it refers to the part of the API which I mentioned:
https://jira.jboss.org/jira/browse/JBPM-2417
Because of this issue https://jira.jboss.org/jira/browse/JBPM-2416 using a process variable is not a good either. This issue deals with audit capabilities regarding method invokations on the API. Sometimes not only the data coming from tasks in the process is interesting but also who has started, stopped or affected a process in some way.
-
8. Re: How send mail to "starter" user
swiderski.maciej Apr 16, 2010 2:16 AM (in response to sebastian.s)Hi Sebastian,
you're right. I took the simplest path of solving it but obviously not the best one.
I have some ideas and questions so perhaps we could move to development forum and discuss it further and as an outcome update both jira issues with final ideas. What do you think?!
Cheers,
Maciej
-
9. Re: How send mail to "starter" user
sebastian.s Apr 16, 2010 5:13 AM (in response to swiderski.maciej)Go ahead.