Closed juniorschroder closed 4 years ago
First of all: expressions will find services under ${environment.services.<yourService>}
. I don't find any documentation regarding service expressions in this project, but it's documentated in bpmn-elements.
The default BPMN2.0 attribute for a service reference is named implementation
, so you can try replacing camunda.expression
with that for starters.
<bpmn:sendTask id="Activity_0c0fmal" name="Avisar Gerente" implementation="${environment.services.serviceFn}" />
camunda:expression
is not handled by default since it is an extension to BPMN 2.0. I use Camunda modeler for testing, like this example on how to implement Camunda as an extension.
@paed01 Thanks for answer, works like a charm. I see that listener.on activity.wait or even wait does not fired when Service Task are started. Any form to do this? Or in my serviceFn, how I can pass a parameter to this function?
One way is to pass function arguments in the expression and return a function:
<bpmn:sendTask id="Activity_0c0fmal" name="Avisar Gerente" implementation="${environment.services.serviceFn('msg')}" />
Then your service function would look something like this:
function serviceFn(name) {
return function send(context, callback) {
// console.log('inspect and look for environment variables', context)
if (name !== 'msg') return callback(new Error('Not a message ' + msg));
return callback(null, name);
};
}
The built in expressions are documented here.
Otherwise you can make an extension to fill up the context with whatever information you like, either by a service task behaviour or by formatting
Great!
Thanks a lot
Hi!
I'm can't understand how to work with this kind of task. I have this simplest process with a SendTask: