This is a process engine question. I’ll figure out eventually how to add a custom task element to my editor palette etc, but I’m not sure how the process will react when I try to deploy the process with customized service task.
I want to create a service task with all form properties that a user task has. The difference will be that this task will not wait for user to react, just generate a form (not asking how to do it for now), store it in a variable and move on, all in the same transaction, like a service task.
I’m guessing I have to extend some of task classes, either user or service, register it with the engine, so that it is not surprised at deploy time when there are some unexpected properties, and the Java delegate will have access to the form definition properties. Or should I not extend anything, if bpmn XML has any property, the delegate will be able to see everything even if the properties are neither in bpmn nor camunda namespace.
So I’m asking for some general advice, hope I was clear:slight_smile: Thanks!
There is a need of a service that will provide form fragments. It will be good if it is defined in bpmn file in the same manner as regular forms. The other way I see is to pass arguments to the java method (the one that’ll be called in the service task), but it’s not that intuitive
Can you be more specific about your use case? Your initial description sounds like you want to have all of the fields of the user task but pre populate them with essentially a script and store the values. Why do you think you need customized service tasks and modeler changes for your use case?
Well, I want extend a service task definition element with the form definition structure, like we currently have in user task or start event elements. The service will generate the form (html) and, say, store it in the process variable. Are you asking why I need this and assume I might actually don’t? I really wouldn’t like to disclose the idea prematurely. Eventually I will. I understand that I gave too much detail for what is really a simple technical question. If you don’t mind, can I rephrase it to some more generic one:
How do I add my own property to a [serviceTask], like you added camunda:expression property, but my own, and do nothing more then make it available to the ‘java delegate’.
I saw you edited your post, now reading that, thanks!
I am asking about your use case because it seems like you are developing a solution to technical problem that does not exist.
So short version: you want to generate some HTML and store it in a process variable. And that HTML would include some values in a form in the modeler? If yes, look at the element templates. You can easily script this or use java delegates to generate the process variable.
@StephenOTT, I am writing my own properties editor (not using the ‘panels’ that have element templates), look:
I was thinking to learn how to create my own namespace (like, fedd:formKey ) / moddle etc, my question is how the service task will see my new property
Okay thanks for the context. That clears it up
When you send your properties into the task, Have you tried submitting them as input variables? Then you can use script or delegate to process them. IMO Would save you a lot of hassle compared to working with a new namespace, parsing the bpmn XML, or camunda extension properties. The input vars already give you so much control with out of box features
In a service task you can use the method DelegateExecution#getBpmnModelElementInstance which returns an instance of org.camunda.bpm.model.bpmn.instance.FlowElement which allows you to access any elements and attributes defined in the XML.