Working with custom model

Hello I have a process that has a custom model, similar to the following model:

{[247f3af4-36cf-72cc-1a95-601f07640674, {{"Title":"mytitle","Value":"AA"}}]}

Now at the gates how can I define expressions?
For example

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

Hi @amir133,

The is not a valid JSON.

Thanks @hassang

I call http://localhost:8080/engine-rest/task/{id}/variables/ and get this response:

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

I think the Json format is correct now?

also I define expressions at gates like these:

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

Or

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

But get this Error

 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'

What should I do? please guide me.

Please try below expression

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

But it gives this error when developing

ENGINE-01009 Error while parsing process. Error parsing '${S(e4c60e57-41c7-f522-08bd-5592b3917c92).prop("Value").stringValue() == "AA"}': syntax error at position 15, encountered 'c7', expected ')'.

I don’t think that using GUID value as a variable name is a good practice.

I believe a different name should be used.

I agree with you but I need variable name to be unique.
What is the input of the S() function? Does the string accept or another type?

Hi @amir133,

The input of S() function is the variable name so double quotes shouldn’t be used.

Thanks @hassang

I try change variable name from 247f3af4-36cf-72cc-1a95-601f07640674 to 247f3af4_36cf_72cc_1a95_601f07640674

If you have another idea, thank you for your help.
You may submit a document related to the S() function?

Hi @amir133,

I believe dash is interrupted as minus operator once used in the expression so a different variable name should be used.

Hi @hassang
I try to use

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

but it show this error

Error parsing '${S(2a9dc884A575dA9332A016aA97b434260f1e).prop("Value").stringValue() == "AA"}': syntax error at position 5, encountered 'a9dc884A575dA9332A016aA97b434260f1e', expected ')'.

Oh my problem Solved!!
I must to start my variable name with character like this:

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

Thank you @hassang

2 Likes