Display fields of type activiti in a businessObject

Hi all!

Question based on this topic - Is it possible to display activiti:formProperty, activiti:value in the Forms tab?

After applying scheme with prefix “activiti” my bussinesObject looks wrong -
https://forum.bpmn.io/uploads/default/original/2X/7/704ebb6850de3016086d8c58bdc76834a262f4d5.png

and original values in xml - https://forum.bpmn.io/uploads/default/original/2X/5/528e32eb673e2866bbd133a7bbc5daf89826604a.png

Any ideas? I feel uri is incorrect

example moddle scheme -

{
  "name": "Activiti",
  "uri": "http://activiti.org/bpmn",
  "prefix": "activiti",
  "xml": {
    "tagAlias": "lowerCase"
  },
  "associations": [],
  "types": [
    {
      "name": "ActivitiUserTask",
      "extends": [
        "bpmn:BaseElement"
      ],
      "properties": [
        {
          "name": "test",
          "isAttr": true,
          "type": "String"
        }
      ]
    },
    {
      "name": "FormProperty",
      "superClass": [
        "Element",
        "UserTask"
      ],
      "properties": [
        {
          "name": "name",
          "isAttr": true,
          "type": "String"
        }
      ]
    },
    {
      "name": "Field",
      "superClass": [
        "bpmn:ServiceTask"
      ],
      "properties": [
        {
          "name": "name",
          "isAttr": true,
          "type": "String"
        }
      ]
    },
    {
      "name": "String",
      "superClass": [
        "activiti:Field"
      ]
    },
    {
      "name": "Expression",
      "superClass": [
        "activiti:Field"
      ]
    }
  ]
}

What are the exact steps to reproduce this behavior?

hi!

Structure

bpmn initialize

this.modeler = new Modeler({
      container: '#canvas',
      width: '100%',
      height: '100%',
      propertiesPanel: {
        parent: '#properties'
      },
      additionalModules: [
        CliModule,
        propertiesPanelModule,
        activitiPropertiesProviderModule
        //propertiesBPMNProvider,
        //camundaExtensionModule,
        //propertiesCamundaProvider,
      ],
      moddleExtensions: {
        bpmn: bpmnModdle,
        //camunda: camundaActivitiSchema,
        activiti: activitiModdleDescriptor
      },
      keyboard: {
        bindTo: document
      },
      cli: {
        bindTo: 'cli'
      }
    });

activitiModdleDescriptor -

{
  "name": "Activiti",
  "uri": "http://activiti.org/activiti",
  "prefix": "activiti",
  "xml": {
    "tagAlias": "lowerCase"
  },
  "associations": [],
  "types": [
    {
      "name": "ActivitiUserTask",
      "extends": [
        "bpmn:BaseElement"
      ],
      "properties": [
        {
          "name": "test",
          "isAttr": true,
          "type": "String"
        }
      ]
    },
    {
      "name": "FormProperty",
      "superClass": [
        "Element",
        "UserTask"
      ],
      "properties": [
        {
          "name": "name",
          "isAttr": true,
          "type": "String"
        }
      ]
    },
    {
      "name": "Field",
      "superClass": [
        "bpmn:ServiceTask"
      ],
      "properties": [
        {
          "name": "name",
          "isAttr": true,
          "type": "String"
        }
      ]
    },
    {
      "name": "String",
      "superClass": [
        "activiti:Field"
      ]
    },
    {
      "name": "Expression",
      "superClass": [
        "activiti:Field"
      ]
    }
  ]
}

  1. Steps to reproduce:
    1. Click to UserTask
    <documentation>;bTemplated=true</documentation>
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="Автор. Кошторис">
      <extensionElements>
        <activiti:formProperty id="sID_Custom_GovPublic1" name="Реєстраційний номер; ;writable=false" type="string"></activiti:formProperty>
        <activiti:formProperty id="sDocName" name="Назва документа" type="string" default="ОРІЄНТОВНИЙ КОШТОРИС ВИТРАТ"></activiti:formProperty>
        <activiti:formProperty id="sPositionHead" name="Посада керівника" type="string" readable="false" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sNameHead" name="ПІБ керівника" type="string" readable="false" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDestination" name="Пункт призначення" type="string" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sTripTask" name="Завдання на відрядження" type="fileHTML" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sToOrganization" name="Найменування установи/організації до якої відряджається" type="string" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateFrom" name="Дата початок" type="date" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateTill" name="Дата кінець" type="date" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateDiff1" name="Строк відрядження" type="string" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sPurpose" name="Мета відрядження" type="fileHTML" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateAgree" name="Дата узгодження" type="date" readable="false" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sNameBuh" name="ПІБ Бухгалтера" type="string" readable="false" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sEmailTest" name="Оповіщення;;bVisible=false" type="string" default="Шановний колего! Вам в роботу надійшов документ у системи IDOC  [sID_Order_URL] " writable="false"></activiti:formProperty>
        <activiti:formProperty id="sBody_1" name="Шаблон звіт;;bVisible=false, bPrintform=true,bDocumentSubTabPrintformDefault=true,bParseTagsOnSubmitOnly=true" type="string" default="{'sPathFile':'1SL8mS3nNAhzVEJ-3O66UGgugIhMPejfz2DDl7fbY13A', 'sSourceType':'GoogleDoc'}" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateActual" name="Поточна дата;;bVisible=false" type="string"></activiti:formProperty>
        <activiti:formProperty id="sLoginA" name="Логин автора;;bVisible=false" type="string" expression="${oDocumentService.getLoginAuthor(execution)}"></activiti:formProperty>
        <activiti:formProperty id="sKerAvtora" name="Тест Отображение керивника;;bVisible=false" type="string" expression="${oDocumentService.getSubjectEmployeeParentLogin(oDocumentService.getLoginAuthor(execution))}"></activiti:formProperty>
        <activiti:formProperty id="markerCount" name="Счетчик Номер док" type="markers"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="scripttask1"></sequenceFlow>
  1. Handle event “element.click” and log to console “event.element.businessObject.extensionElements”
  1. Expected
    1. activities should have $type -> “activiti:formProperty”, so that I can use moddle for removing, creating, editing items
  2. What I got
    1. activities have $type -> “ns0:formProperty”, and moddle can’t remove, create, edit and I can’t see items in properties panel

Original XML with user task:

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test">
  <process id="_doc_template_covkmudep_businesstrip_report" name="Відрядження по Україні_Звіт" isExecutable="true">
    <documentation>;bTemplated=true</documentation>
    <startEvent id="startevent1" name="Start"></startEvent>
    <userTask id="usertask1" name="Автор. Кошторис">
      <extensionElements>
        <activiti:formProperty id="sID_Custom_GovPublic1" name="Реєстраційний номер; ;writable=false" type="string"></activiti:formProperty>
        <activiti:formProperty id="sDocName" name="Назва документа" type="string" default="ОРІЄНТОВНИЙ КОШТОРИС ВИТРАТ"></activiti:formProperty>
        <activiti:formProperty id="sPositionHead" name="Посада керівника" type="string" readable="false" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sNameHead" name="ПІБ керівника" type="string" readable="false" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDestination" name="Пункт призначення" type="string" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sTripTask" name="Завдання на відрядження" type="fileHTML" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sToOrganization" name="Найменування установи/організації до якої відряджається" type="string" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateFrom" name="Дата початок" type="date" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateTill" name="Дата кінець" type="date" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateDiff1" name="Строк відрядження" type="string" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sPurpose" name="Мета відрядження" type="fileHTML" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateAgree" name="Дата узгодження" type="date" readable="false" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sNameBuh" name="ПІБ Бухгалтера" type="string" readable="false" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sEmailTest" name="Оповіщення;;bVisible=false" type="string" default="Шановний колего! Вам в роботу надійшов документ у системи IDOC  [sID_Order_URL] " writable="false"></activiti:formProperty>
        <activiti:formProperty id="sBody_1" name="Шаблон звіт;;bVisible=false, bPrintform=true,bDocumentSubTabPrintformDefault=true,bParseTagsOnSubmitOnly=true" type="string" default="{'sPathFile':'1SL8mS3nNAhzVEJ-3O66UGgugIhMPejfz2DDl7fbY13A', 'sSourceType':'GoogleDoc'}" writable="false"></activiti:formProperty>
        <activiti:formProperty id="sDateActual" name="Поточна дата;;bVisible=false" type="string"></activiti:formProperty>
        <activiti:formProperty id="sLoginA" name="Логин автора;;bVisible=false" type="string" expression="${oDocumentService.getLoginAuthor(execution)}"></activiti:formProperty>
        <activiti:formProperty id="sKerAvtora" name="Тест Отображение керивника;;bVisible=false" type="string" expression="${oDocumentService.getSubjectEmployeeParentLogin(oDocumentService.getLoginAuthor(execution))}"></activiti:formProperty>
        <activiti:formProperty id="markerCount" name="Счетчик Номер док" type="markers"></activiti:formProperty>
      </extensionElements>
    </userTask>
    <sequenceFlow id="flow1" sourceRef="startevent1" targetRef="scripttask1"></sequenceFlow>
    <endEvent id="endevent2" name="End"></endEvent>
    <serviceTask id="servicetask3" name="Роль Бухгалтер" activiti:delegateExpression="${setDocumentSignersListener}">
      <extensionElements>
        <activiti:field name="sKey_TemplateSigner">
          <activiti:string><![CDATA[_default_seen]]></activiti:string>
        </activiti:field>
        <activiti:field name="sKey_Step">
          <activiti:string><![CDATA[step_seen]]></activiti:string>
        </activiti:field>
        <activiti:field name="sasLogin">
          <activiti:expression><![CDATA[${oSubjectRoleService.getsEmployeesLoginsOfRoles('buhgalter',null)}]]></activiti:expression>
        </activiti:field>
        <activiti:field name="sKey_Fields">
          <activiti:string><![CDATA[sEmailTest]]></activiti:string>
        </activiti:field>
      </extensionElements>
    </serviceTask>
    <sequenceFlow id="flow22" sourceRef="servicetask3" targetRef="servicetask4"></sequenceFlow>
......
......
.....

Thanks @philippfromme

Can you please stick to using Markdown code blocks? Screenshots are incredibly hard to read.

fixed in previous reply

How can FormProperty inherit from UserTask?

Same here, the inheritance doesn’t make sense.

Have you had a look at this example: https://github.com/bpmn-io/bpmn-js-example-model-extension

It’s quite similar to what you’re doing.

Thank you for your time!

I used this resourses - https://github.com/bpmn-io/bpmn-js-example-model-extension

And I’m sorry for this “superClass”: [ “Element”, “UserTask” ],
These are the residues after the debug - I wanted to track how the change in these fields affects.

Now I have very simple scheme:

{
  "name": "Activiti",
  "uri": "http://activiti.org/activiti",
  "prefix": "activiti",
  "xml": {
    "tagAlias": "lowerCase"
  },
  "associations": [],
  "types": [
    {
      "name": "FormProperty",
      "properties": [
        {
          "name": "name",
          "isAttr": true,
          "type": "String"
        }
      ]
    }
  ]
}

Same result -> $type = “ns0”

Sorry for disinformation

One more thing ->

Steps:

  1. If I have another prefix, for example test
{
  "name": "Activiti",
  "uri": "http://activiti.org/activiti",
  "prefix": "test",
  "xml": {
    "tagAlias": "lowerCase"
  },
  "associations": [],
  "types": [
    {
      "name": "FormProperty",
      "properties": [
        {
          "name": "name",
          "isAttr": true,
          "type": "String"
        }
      ]
    }
  ]
}

  1. And after clicking to UserTask I see in businessObject:
    image

I had similar problem.
When URl in definitions, both in XML and *.json (file with model extension), not match, modeler adds this tags with ‘ns0’ prefix. Solution is simple:
Definition:
xmlns:activiti=“http://activiti.org/bpmn
and uri in *.json:
“uri”: “http://activiti.org/activiti
must be the same.

Chris

1 Like