Supported tasks for Element Templates

Hi,

I want to start with a big “Thank You”. The extended Element Templates (v1.4) take us a big step forward.

We are able to reduce modelling time for simple demos or PS workflows from an hour to minutes (less options for the modelling user is more and means no errors).
We managed to wrap the call activities into templates and make things very easy here by setting defaults and/or hiding settings.

We did not find a way to support templating for a script task. Searching for a workaround, we saw that the “Manual Task” matches the available options templates currently allow:

  • It supports “camunda:inputParameter” to pass user parameters
  • It supports “camunda:executionListener” to actually execute the script

Yes, visually a bit dirty but a working solution till we have support for the “bpmn:script”-binding. We first tried the generic “Task” but it will not be accepted by the engine if it contains “camnda:inputOutput”, despite the modeller shows this option.

Are there any plans to extend to other bindings in order to templatize?

  • Connectors
  • User Tasks
  • Script Tasks

+1 on the connector support. If issue queue is up to date, looks like it is not supported yet: https://github.com/camunda/camunda-modeler/issues/308

@wke-rec Could you be very specific about the script task extension you are mentioning:

  • Provide the target XML you would like to end up with
  • List the stuff you’d like to define as part of a template and the parts that should be (if any) controlled by the citizen developer / modeler

That helps us to better understand the missing pieces.

Thanks! :slight_smile:

Hi Nikku,

here what we envision to

  • allow adding a standard script task that will be fed with some input parameters
  • allow to in addition modify the script to exact needs

I just quickly sketched from the top of my head. I hope there are not too many mistakes in it but should hopefully be enough to extract what I mean:

[
    {
        "appliesTo": [
            "bpmn:ScriptTask"
        ],
        "id": "Fibonacci",
        "name": "Calculate Fibonacci",
        "properties": [
            {
                "binding": {
                    "name": "name",
                    "type": "property"
                },
                "label": "Task Name",
                "type": "Hidden",
                "value": "Calculate Fibonacci"
            },
            {
                "binding": {
                    "name": "scriptFormat",
                    "type": "property"
                },
                "type": "Hidden",
                "value": "Groovy"
            },
            {
                "binding": {
                    "name": "fibParam",
                    "type": "camunda:inputParameter"
                },
                "description": "Input number to calculate Fibonacci",
                "label": "Input value",
                "type": "String",
                "value": "8"
            },
            {
                "binding": {
                    "type": "bpmn:script"
                },
                "type": "Hidden",
                "value": "<![CDATA[def fib(n) {n<2 ? 1 : fib(n-1)+fib(n-2)}\nfib(fibParam)]]>"
            },
            {
                "binding": {
                    "name": "camunda:resultVariable",
                    "type": "property"
                },
                "description": "Name of the variable containing the result.",
                "label": "Resulting Fibonacci value",
                "type": "String",
                "value": "outputValue"
            }
        ]
    },
    {
        "appliesTo": [
            "bpmn:ScriptTask"
        ],
        "id": "MapUserTable",
        "name": "Map User List",
        "properties": [
            {
                "binding": {
                    "name": "name",
                    "type": "property"
                },
                "label": "Task Name",
                "type": "Hidden",
                "value": "Map User List"
            },
            {
                "binding": {
                    "name": "scriptFormat",
                    "type": "property"
                },
                "type": "Hidden",
                "value": "Groovy"
            },
            {
                "binding": {
                    "name": "filterUsers",
                    "type": "camunda:inputParameter"
                },
                "description": "Commas separated list of users to filter. Empty for all users.",
                "label": "Filter by users",
                "type": "String",
                "value": ""
            },
            {
                "binding": {
                    "type": "bpmn:script"
                },
                "description": "Groovy Script to filter and map user information",
                "label": "Apply mapping of input (Groovy script)",
                "type": "Text",
                "value": "<![CDATA[import groovy.json.JsonSlurper\nimport java.util.logging.Logger\n\nLogger log = Logger.getLogger(\"mapUserData\")\n\nlog.info(\"mapping users '$filterUsers'\")\nresult = users.findAll{ user -> user.id in filterUsers.split(',')}.collect{ \n    filteredUser = [:]\n\n// Change Mapping depending on required result information\n    filteredUser.id = it.id\n    filteredUser.mail = it.email\n    filteredUser\n}\nresult]]>"
            },
            {
                "binding": {
                    "name": "camunda:resultVariable",
                    "type": "property"
                },
                "description": "Name of the variable containing the result.",
                "label": "Resulting map with user data",
                "type": "String",
                "value": "outputValue"
            }
        ]
    }
]

Thanks for your example, it helps me understanding!