Object Type changed when updated via TaskList

Following these steps: I am unable to reproduce your bug:

var myJson = S(‘{“someKey”:“someValue”,“someOtherKey”:“someOtherValue”}’)

Running on 7.15.

The JSON variables do not load without a pre-defined form.

and the submission does not contain any re-written json:

and we can see in cockpit that everything is still working:

Let me create a small project for you to see in GitHub.

@StephenOTT please see if you could clone: GitHub - hammad-k-dar/camunda-poc: POCs related to Camunda

Cockpit user/pass: demo/demo
URL to start process: http://localhost:8080/start

It has embedded H2 database so nothing else should be required. Please do check application.properties as i have some properties added for Camunda, which should not be problematic as well.

Once you start the process, it will print dto values and move the process to User Task. Just open the task in TaskList and:

  1. Add new variable named as “review” of type String and give value “retry”.
  2. Press Load Variables button but do not do anything with the json value.
  3. Complete

See the console as our delegate tries to get the value pulled up and crashes.

Thank you once again for your time, really appreciated.

Thanks

class MyTest implements JavaDelegate{

    @Override
    void execute(DelegateExecution execution) throws Exception {

        def myMap = new HashMap()
        myMap.put("someKey", "SomeValue")

        def myVar = Variables.objectValue(myMap).serializationDataFormat(Variables.SerializationDataFormats.JSON).create()
        execution.setVariable("myJson", myVar)
    }
}

Looks fine.

What behaviour is unexpected for you based on my images above?

@StephenOTT did you check the project i created? May be accessing the variable again from the Java Delegate is the problem, what do you think? You need to create a service task and then get the variable from the DelegateExecution. Probably it works fine in your case but it crashes straight-forwardly in the project i shared.

Hello @StephenOTT - Did you get a chance to run the project I shared? Please could you advise whether a ticket should be opened up for this issue?

@Hammad_Dar I was able to reproduce the issue stated when we set review=retry

great @aravindhrs , so please advise the way forward here?

@Hammad_Dar in the future it would be much better if you did some trial and error based on the working examples I provided. It feels like you dropped this problem without any basic trial and error testing and working from the known example that was working (the screenshots i shared) and then working step by step to identify your problem…

You problem is you are using an incorrect configuration on your service task. I don’t know why off the top of my head, but when you have Async and it runs as a job, the expression evaluator is acting “differently”.

You can see the behaviour occur if you try and create any variable (such as a basic string) within your Delegate.

.

A common complaint and unresolved UX issue: Impacts of not using Delegate Expression for SpringBoot Java Delegate Resolution needs to be highlighted more clearly in docs!?

Hello @StephenOTT - I have been trying different options but probably in the wrong area. Please note that I am very new to the platform.

Secondly, I cannot say anything but it starts before our Service Task is hit second time. Once the form ins loaded in Task List application and user loads the variables and presses “Complete”, that is where the bytearray is changed and its version is updated from 1 to 2. That is where I was suspicious.

I simply was not expecting this kind of issue which is the basic scenario as far as I see this in the platform. If you could see the title of the issue, you would understand where my energies were targeted towards.

Initially, I thought the change is causing the issue, looked for the JacksonJsonDataFormat and implemented that to see if my object structure is of the issue, then I tried a custom deserializer and once the issue was there after that, then i did a small POC to check the platform in a small application. It has been quite a while since I am trying to wrap my head around it, all the help available over the internet points towards wrong object structure for the error I posted earlier. Lastly I created a working example for you guys to check and I was expecting an issue to be opened up for this if this is the issue. I am definitely missing something if hit and trial was due at my end.

Thank you for your time.

Did changing to “delegateExpression” resolve the problem?

@StephenOTT No it did not, I tried it with DelegateExpression as well, pushed the code as well which I tried. Tried with different Async Before and Async After combinations as well, same result.

Logically, If the problem does not occur without pressing “Load Variables” then apparently the area which seems problematic is where data is being sent to the server from the form, right?

I tried the same setup with 7.14.0 and that version does not allow to load all variables in the current execution. It means this behavior is 7.15+.

By the way, tried with 7.16.0-alpha2 and issue exists in that version as well.

@Hammad_Dar you say it did not work, but again you did not provide any of the debugging information, a screenshot of tasklist network inspector showing the API calls, etc. You need help me so we can help you…

If you would have provided the screenshots as requested for task list we could have seen your problem is due the handling of the escaping:

Load Variables:

submit:

and we can then see in cockpit that your object is wrapped in your DTO:

and we can see an incident which you did not mention:

So yes it would seem that the UI is not handling application/json serialization in the way you would expect.

This behaviour only seems to happen with the “Object” handling in tasklist.

IMO with the screenshots above you have enough to log a jira ticket as a potential ui bug (unless there is some sort of behaviour that is excepted given your use of json - where json is a weird type of object to pass: In other object types you are passing a serialized value (string of the object), but in the JSON example it is returning the json unescaped, and then submitting it back as escaped and the deserializer is unable to handle it.

Also to be clear: The problem is not occurring because it selected “Load Variables”. The problem is occurring because it is submitting variables (one of which is the DTO you collected through the Load Variables button) back into the engine.

Hello @StephenOTT - My initial comments have the URL, the payload being sent to the server and my initial understanding as well, which is correct as you confirmed it, that object type is being changed due to the json which is received. It becomes String and TextNode is created against this value by Jackson.

“Load Variables” is the interaction and the starting point and that is why it is mentioned.

I am not sure if really it is necessary to post all the details again when those are already shared and even a project is updated after you asked to check with DelegateExpression. Which implies that all the input I provided, the project I shared were not looked at as well.

All the community driven projects require smallest possible setup which produces the issue whenever there is some query on the support forums. I frankly do not understand what that is not enough here.

Any news on this?

I have another project suffering from the same issue.

There’s this jira ticket [CAM-13463] Deserialisation fails for objects after saving generic form in Tasklist - camunda JIRA