camundacamunda-plugincamunda-spin

define expression in camunda


I have a process that has a custom model, similar to the following model(get by calling http://localhost:8080/engine-rest/task/{id}/variables/):

{
    "Title": {
        "type": "String",
        "value": "aaa",
        "valueInfo": {
          
        }
      },
    "247f3af4-36cf-72cc-1a95-601f07640674": {
        "type": "String",
        "value": "{\"Title\":\"AA\",\"Value\":\"BB\"}",
        "valueInfo": {
      
        }
    }
}

I want to define a expressions at the gates. How should I do this?

I try these:

${ "247f3af4-36cf-72cc-1a95-601f07640674".Value == "AA"}

Or

${ JSON("247f3af4-36cf-72cc-1a95-601f07640674").prop("Value") == "AA"}

Or

${S(247f3af4-36cf-72cc-1a95-601f07640674).prop("Value").stringValue() == "AA"}

But get following errors:

Unknown property used in expression: ${ "247f3af4-36cf-72cc-1a95-601f07640674".Value == "AA"}. Cause: Could not find property Value in class java.lang.String
Error while evaluating expression: ${ JSON("247f3af4-36cf-72cc-1a95-601f07640674").prop("Value") == "AA"}. Cause: Error invoking function 'JSON'
ENGINE-01009 Error while parsing process. Error parsing '${S(247f3af4-36cf-72cc-1a95-601f07640674).prop("Value").stringValue() == "AA"}': syntax error at position 15, encountered 'c7', expected ')'.

enter image description here


Solution

  • I finally find answer I must use something like this:

    ${S(a247f3af4_36cf_72cc_1a95_601f07640674).prop("Value").stringValue() == "AA"}
    

    we must start variable name with character and do'nt use -.