Custom properties in Element template for service task Field Injections

Hi,

is it possible to set “Field Injections” in a service task as well via an element templates? I did not find something in the description!

I also tried to use “camunda:field” in the binding parameter, but it did not work.

Thanks,

Alexander

We do not support field injections to be defined via element templates at the moment.

What exactly would you like to configure there? What should be the parts the modeler / citizen developer can define?

Hi,

we have some JavaDelegates or delegate expressions that are using that expression field injection for their bean properties. For easier use of these delegates in the designer we would like to make templates in the designer. Currently that is not possible.

Thanks for your info,

Alexander

For easier use of these delegates in the designer we would like to make templates in the designer.

  • What should be hard-coded in the templates?
  • What should be the parts to be filled in by delegate users later on?

Hi,

it should work very similar to the possible configuration of input/output parameters in a template. So the template could look like that:

{
"label": "Type in name",
"type": "String",
"editable": true,
"binding": {
	"type": "camunda:field",
	"name": "fieldName"
},
"constraints": {
	...
}
},...

and the outcoming XML would look like that:

... 
<bpmn:extensionElements>
    ....
    <camunda:field name="fieldName">
       <camunda:string>typed in value</camunda:string>
    </camunda:field>
    ...
</bpmn:extensionElements>
...

Like the custom input/output defined fields on the task, that field should be displayed in the general tab of the task in the section custom fields.

Hope that had it make more clear.

Thanks

Alexander

Thanks for the example you provided. I opened the issue camunda-modeler#483 to track this.

I’d like to refresh this topic. Any progress at now with injecting field values?

1 Like

I’d like to refresh it too. We are now trying to migrate from the Eclipse plugin to the new modeller, but our diagrams rely hard on field injections. It would be great if this feature would be available. Thanks

+1 I would really like to see this feature added.

Also requested here.

1 Like

Would https://github.com/camunda/camunda-modeler/issues/483 address expressions inside of <camunda:property> as well? Or just <camunda:field>?

We use something like this (note the expressions inside of the camunda:properties):

<bpmn:serviceTask id="Task_1p9391z" camunda:modelerTemplate="com.foo.task.EmailTask" camunda:class="com.foo.task.EmailTask">
  <bpmn:extensionElements>
    <camunda:properties>
      <camunda:property name="bodyType" value="html" />
      <camunda:property name="smtpHost" value="smtp.foo.com" />
      <camunda:property name="smtpPort" value="25" />
      <camunda:property name="preCondition" value="" />
      <camunda:property name="onPreConditionFail" value="ABORT_PROCESS" />
      <camunda:property name="from" value="bob@gmail.com" />
      <camunda:property name="to" value="${recipientEmailAdress}" />
      <camunda:property name="body" value="test is a message to ${recipientEmailAddress}" />
      <camunda:property name="subject" value="${emailHelperBean.getSubject()}" />
    </camunda:properties>
  </bpmn:extensionElements>
  <bpmn:incoming>SequenceFlow_0s5hqtl</bpmn:incoming>
</bpmn:serviceTask>

with elements.json something like:

{
“label”: “Email Subject”,
“type”: “String”,
“binding”: {
“type”: “camunda:property”,
“name”: “subject”
 }
}

thank you a lot for the link and generally thanks everyone for everything! I appreciate it a lot! however i wanted to ask you people, if i am going to have some questions for you, could you be that kind helping me? thanks!

As far as I am aware, camunda:property does not support expressions.

camunda/camunda-modeler#483 won’t change that situation. But you would be able to switch to camunda:field once it is supported to get expression support.

Hi all,

The feature has been added to the modeller, that’s great news, thank you guys a lot!!! There seem to by only one problem. The modeller now generates and supports this syntax:

<camunda:field name="fieldName">
   <camunda:string>typed in value</camunda:string>
</camunda:field>

However, it’s not supporting the short syntax:

<camunda:field name=“fieldName” stringValue=“some value”/>

Is that intentional? I don’t see the stringValue attribute being deprecated. I understand that when generating a diagram there should be only one supported, but when opening an existing diagram with stringValue instead of camunda:string - it’s not reading it.

Thank you again!