Hi,
I guess we could investigate this from scratch ourself, but maybe we can win some time if somebody could point us to the correct steps: What should be done to make a custom function/service available in JUEL expressions in the BPMN process?
Example usecase: I have a process that contains a mail task that should be sent to a user involved in the process. What we currently do: in one of the preceeding steps before the mail task, we store the required fields as separate variables (so at least three process variables: ‘useremail’, ‘userfirstname’ and ‘userlastname’).
This is somewhat redundant, though, because the database contains users with mail, first, lastname as attributes. I would like to make it possible for our users to configure a JUEL expression, that, for example, would be,
- for the ‘To’ field of the mail task:: ${FunkyUserService.getUser(username).getEmailAddress()}
- for the ‘text’ (mail body) “Hello {FunkyUserService.getUser(username).getFirstname()} {FunkyUserService.getUser(username).getLastname()}”
- … or even better "${SomeUserService.getUser(username).getFullName()} "
… and obviously this FunkyUserService would use our own internal userService to fetch the user’s attributes at runtime from the db, when the JUEL expression is evaluated.
Because, who knows, maybe the user’s email adress has changed between storing the initial useremail procesvariable, and the time the email gets sent.
(Note that we use flowable as a platform ; our users don’t write java code themselves so we want to make “FunkyUserService” available as a JUEL expression)
And, it would be very nice to have this same function / expression working in the DMN decisiontable JUEL expression as well.
What steps should be taken, roughly, to achieve this?