Element template with camunda modeler

Hi Team,

I’m in the process of learning more about Camunda and element templates that I can utilise to define my workflow.

While browsing the web, I came across a page that explains how to design my own element templates.

However, even after placing the element template in the resource folder, I am still unable to access the template choice in my workflow. I’ve also checked that the job type matches the template, but I still don’t see the template choice in Camunda Modeller.

Please find the below environment details of my system.

Operating System : Mac OS
Camunda Modeler Version : 5.7.0
Workflow created with : Camunda 8 with BPMN
Path where i have added the element-template : /Users/rajagandharaw/Library/Application Support/camunda-modeler
Element template copy from : camunda-modeler/resources/element-templates/samples.json at master · camunda/camunda-modeler · GitHub (name : Mail Task)
Type on the module workflow : Service Task

I rebooted the system several times after inserting the element template.

Can someone please suggest how to fix this issue?

Thanks & Regards,
Raja Gandharaw.

Hello @GRajaMca - I believe the full path to your template should be: /Users/rajagandharaw/Library/Application Support/camunda-modeler/resources/element-templates. Can you confirm that’s the directory your template file is in?

@nathan.loding, Yes you are right.

My full path is /Users/rajagandharaw/Library/Application Support/camunda-modeler/resources/element-templates/sample-element-template.json

That should be all you need to do. I tested it with my Desktop Modeler installation and it worked. I skimmed through the changelog and nothing stood out - however, I noticed you’re on version 5.7.0 and the latest version is v5.12.1. I would try updating Modeler first and see if that resolves the issue. I would also open that template in Modeler and make sure there are no errors in it.

Hi @nathan.loding, I have upgraded the camunda modeler in my machine. even after doing that also template option is not appearing in the workflow definition. Can you please suggest what could be the wrong here ?

I have also attached the screen shots of my configurations,camunda modeler and workflow as well.

I have also even ensured the respective file permission, even then it’s not working. No errors on the camunda modeler.

sample.bpmn (2.8 KB)



element.bpmn (2.7 KB)


Can you share your template? From the docs: If a template matches a selected diagram element, the template catalog button will be shown in the properties panel. - my guess is that your template is misconfigured somehow and isn’t matching the service task.

@nathan.loding,
Please find the below sample element template which i have used in my machine.

 [ {
    "$schema": "https://unpkg.com/@camunda/element-templates-json-schema/resources/schema.json",
    "name": "Mail Task",
    "id": "com.camunda.example.MailTask",
    "appliesTo": [
      "bpmn:ServiceTask"
    ],
    "properties": [
      {
        "label": "Implementation Type",
        "type": "String",
        "value": "com.mycompany.MailTaskImpl",
        "editable": false,
        "binding": {
          "type": "property",
          "name": "camunda:class"
        }
      },
      {
        "label": "Sender",
        "type": "String",
        "binding": {
          "type": "camunda:inputParameter",
          "name": "sender"
        },
        "constraints": {
          "notEmpty": true,
          "pattern": {
            "value": "^[A-z0-9._%+-]+@[A-z0-9.-]+\\.[A-z]{2,}$",
            "message": "Must be a valid email."
          }
        }
      },
      {
        "label": "Receivers",
        "type": "String",
        "binding": {
          "type": "camunda:inputParameter",
          "name": "receivers"
        },
        "constraints": {
          "notEmpty": true
        }
      },
      {
        "label": "Template",
        "description": "By the way, you can use <a href=\"https://freemarker.apache.org/\">freemarker templates</a> here",
        "value": "Hello ${firstName}!",
        "type": "Text",
        "binding": {
          "type": "camunda:inputParameter",
          "name": "messageBody",
          "scriptFormat": "freemarker"
        },
        "constraints": {
          "notEmpty": true
        }
      },
      {
        "label": "Result Status",
        "description": "The process variable to which to assign the send result to",
        "value": "mailSendResult",
        "type": "String",
        "binding": {
          "type": "camunda:outputParameter",
          "source": "${ resultStatus }"
        }
      },
      {
        "label": "Send Async?",
        "type": "Boolean",
        "value": true,
        "binding": {
          "type": "property",
          "name": "camunda:asyncBefore"
        }
      }
    ]
  }
]

This sample element template is copied from official site of camunda only. camunda-modeler/resources/element-templates/samples.json at master · camunda/camunda-modeler · GitHub

Note
Am using Mac M1 Pro.

@GRajaMca - I did some testing and found what’s happening: The schema selected in that template, and some of the configuration, is C7 specific; if you start a new model targeted at C8 in Modeler, you won’t see this template.

There are a couple things to tweak in the template to get it working in Modeler with C8:

  1. Change the $schema to "https://unpkg.com/@camunda/zeebe-element-templates-json-schema/resources/schema.json"
  2. Change all the camunda:inputParameter bindings to zeebe:input
  3. Change camunda:outputParameter to zeebe:output
  4. Remove the “Send Async?” property, because C8 is asynchronous by default

After those changes, it appears in Modeler for C8!

I am not sure the first property works in C8 - I have to do some research on that - but at least this gets you started!

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.