How to deploy a workflow model ?

MohamedRC
MohamedRC Member
edited April 29 in Thrust Services #1

I'm facing an issue in deploying a workflow model that's desinged using the workflow modeler in vs code using the api call POST /runtime/models (N.B : The hole app has been deployed with success to default tenant)

The model content is in json format, how to export it in xml or BPMN2.0 from workflow modeler ?

How to validate the workflow model or chech the validation errors from the workflow modeler ?

Because validation the process model using POST /models/validation , it seems that the process has validation errors. !

Also the version of the workflow modeler in the docs seems to be changed , the buttons in the screenShot are no longer available !!

Thank you .

Answers

  • LazarescuA
    LazarescuA E Community Moderator

    Hello @MohamedRC ,

    The modelContent that you have in your call does not seem the right one.

    If you want to see what your deployed model looks like, you can do a GET to

    /workflow/v1/runtime/models/<model_id>?modelType=json

    (and you get a json model back)

    or, /workflow/v1/runtime/models/<model_id>?modelType=xml

    (and you get a bes64 encoded xml bpmn back)

    For validation, you can do a POST to /workflow/v1/models/validation with the same payload as what you would be creating the model, and you should receive a response either 200 if there are no validation errors or a 400 error with description for when you have validation errors.

    To exemplify what a JSON model looks like, below is a simple model with one manual task:

    {
    "modelType": "json",
    "modelContent": {
    "modelId": 1,
    "bounds": {
    "lowerRight": {
    "x": 1854,
    "y": 1050
    },
    "upperLeft": {
    "x": 0,
    "y": 0
    }
    },
    "properties": {
    "generalgroupheader": "",
    "process_id": "MyProcess",
    "name": "My Process",
    "detailsgroupheader": "",
    "process_version": "",
    "process_namespace": "lib_app",
    "process_historylevel": "audit",
    "dataproperties": "",
    "process_potentialstarteruser": "",
    "process_potentialstartergroup": "",
    "signaldefinitions": "",
    "messagedefinitions": "",
    "escalationdefinitions": "",
    "duedatedefinition": "",
    "executiongroupheader": "",
    "isasynchistoryenable": true,
    "isexecutable": true,
    "eventlisteners": "",
    "executionlisteners": "",
    "documentation": "My Process"
    },
    "childShapes": [
    {
    "resourceId": "startEvent1",
    "properties": {
    "generalgroupheader": "",
    "overrideid": "",
    "name": "",
    "detailsgroupheader": "",
    "initiator": "",
    "executiongroupheader": "",
    "executionlisteners": ""
    },
    "stencil": {
    "id": "StartNoneEvent"
    },
    "childShapes": [],
    "outgoing": [
    {
    "resourceId": "sid-2E688979-311C-40EA-880E-B836C0EA7E4E"
    }
    ],
    "bounds": {
    "lowerRight": {
    "x": 130,
    "y": 193
    },
    "upperLeft": {
    "x": 100,
    "y": 163
    }
    },
    "dockers": []
    },
    {
    "resourceId": "sid-54D1C0E0-6A08-4C5C-B919-9B34922BF61A",
    "properties": {
    "generalgroupheader": "",
    "overrideid": "",
    "name": "",
    "detailsgroupheader": "",
    "usertaskassignment": {
    "assignment": {
    "type": "idm",
    "idm": {
    "type": "initiator"
    },
    "initiatorCanCompleteTask": false
    }
    },
    "usertasknature": "",
    "duedatedefinition": "",
    "prioritydefinition": "",
    "executiongroupheader": "",
    "asynchronousdefinition": "false",
    "isforcompensation": "false",
    "exclusivedefinition": "false",
    "skipexpression": "",
    "tasklisteners": "",
    "executionlisteners": "",
    "completioncondition": "",
    "tasktype": "default",
    "outcomevariable": "",
    "possibleoutcomes": "",
    "categorydefinition": "",
    "multiinstance_type": "",
    "multiinstance_cardinality": "",
    "multiinstance_collection": "",
    "multiinstance_variable": "",
    "multiinstance_condition": "",
    "multiinstance_collection_class": ""
    },
    "stencil": {
    "id": "UserTask"
    },
    "childShapes": [],
    "outgoing": [
    {
    "resourceId": "sid-5E036D9A-D05A-4F91-9ADF-11E38052F827"
    }
    ],
    "bounds": {
    "lowerRight": {
    "x": 280,
    "y": 218
    },
    "upperLeft": {
    "x": 180,
    "y": 138
    }
    },
    "dockers": []
    },
    {
    "resourceId": "sid-103372F0-AA0D-4041-B440-293CCE9970C5",
    "properties": {
    "generalgroupheader": "",
    "overrideid": "",
    "name": "",
    "executiongroupheader": "",
    "executionlisteners": ""
    },
    "stencil": {
    "id": "EndNoneEvent"
    },
    "childShapes": [],
    "outgoing": [],
    "bounds": {
    "lowerRight": {
    "x": 353,
    "y": 192
    },
    "upperLeft": {
    "x": 325,
    "y": 164
    }
    },
    "dockers": []
    },
    {
    "resourceId": "sid-5E036D9A-D05A-4F91-9ADF-11E38052F827",
    "properties": {
    "generalgroupheader": "",
    "overrideid": "",
    "name": "",
    "detailsgroupheader": "",
    "mandatoryinfo": "",
    "conditionsequenceflow": "",
    "defaultflow": "false",
    "skipexpression": "",
    "executiongroupheader": "",
    "executionlisteners": ""
    },
    "stencil": {
    "id": "SequenceFlow"
    },
    "childShapes": [],
    "outgoing": [
    {
    "resourceId": "sid-103372F0-AA0D-4041-B440-293CCE9970C5"
    }
    ],
    "bounds": {
    "lowerRight": {
    "x": 324.375,
    "y": 178
    },
    "upperLeft": {
    "x": 280.390625,
    "y": 178
    }
    },
    "dockers": [
    {
    "x": 50,
    "y": 40
    },
    {
    "x": 14,
    "y": 14
    }
    ],
    "target": {
    "resourceId": "sid-103372F0-AA0D-4041-B440-293CCE9970C5"
    }
    },
    {
    "resourceId": "sid-2E688979-311C-40EA-880E-B836C0EA7E4E",
    "properties": {
    "generalgroupheader": "",
    "overrideid": "",
    "name": "",
    "detailsgroupheader": "",
    "mandatoryinfo": "",
    "conditionsequenceflow": "",
    "defaultflow": "false",
    "skipexpression": "",
    "executiongroupheader": "",
    "executionlisteners": ""
    },
    "stencil": {
    "id": "SequenceFlow"
    },
    "childShapes": [],
    "outgoing": [
    {
    "resourceId": "sid-54D1C0E0-6A08-4C5C-B919-9B34922BF61A"
    }
    ],
    "bounds": {
    "lowerRight": {
    "x": 179.5859375,
    "y": 178
    },
    "upperLeft": {
    "x": 130.375,
    "y": 178
    }
    },
    "dockers": [
    {
    "x": 15,
    "y": 15
    },
    {
    "x": 50,
    "y": 40
    }
    ],
    "target": {
    "resourceId": "sid-54D1C0E0-6A08-4C5C-B919-9B34922BF61A"
    }
    }
    ],
    "stencil": {
    "id": "BPMNDiagram"
    },
    "stencilset": {
    "namespace": "http://b3mn.org/stencilset/bpmn2.0#",
    "url": "../editor/stencilsets/bpmn2.0/bpmn2.0.json"
    }
    }
    }

  • MohamedRC
    MohamedRC Member
    edited April 30 #3

    @LazarescuA , got this error when creating a new process instance (process model is deployed and has no validation errors)

    what could be the issue ? Thank you

  • LazarescuA
    LazarescuA E Community Moderator

    Hello,

    So, you are now trying to create a new process instance based on a workflow model. Can you provide the payload for your call? Is the process definition deployed? Can you see it in the list of executable process definitions (GET to /runtime/models)?

  • Hello Alex ,

    The issue was in the workflow itself , although it's deployed and has now validation errors , creating process

    instance fails with this error

    This is the payload for POST {{workflow_service_url}}/process-instances

    {
    "processDefinitionKey":"corresspondence_case_approval",
    "name":"Approve Case",
    "outcome":"none",
    "sameDeployment":true,
    "variables":[
    {
    "name":"base_url",
    "value":"https://na-1-dev.api.opentext.com"
    },
    {
    "name":"case_trait",
    "value":"corres_incoming_correspondence_case_trait"
    },
    {
    "name":"case_trait_instance_name",
    "value":"Incoming Case Trait"
    },
    {
    "name":"case_type",
    "value":"corres_incoming"
    },
    {
    "name":"case_id",
    "value":"c2a4f77d-d8b3-4083-ab4d-7749bb7e0720"
    }
    ],
    "returnVariables":true
    }

  • jpluimers
    jpluimers E Community Moderator

    @MohamedRC, just curious wrt the original question:
    'I'm facing an issue in deploying a workflow model that's desinged using the workflow modeler in vs code using the api call POST /runtime/models (N.B : The hole app has been deployed with success to default tenant)'

    Why did you want to deploy the workflow mode via an API call, instead of via VS Code or the ocp cli? What is the use case?

  • @jpluimers , what I remember is that the workflow model can't be validated from VS Code .

  • jpluimers
    jpluimers E Community Moderator

    Did you solve the issue in the end?

  • yes ,

    I did