Implementing DSL workflows

Thanks @tihomir
I tried this way , and it worked.
On getting the activity result , set it directly in the data field
is this a correct way?

 public void addResults(Object result) {

    **this.value.set("data",mapper.valueToTree(result));**
   // ((ArrayNode) this.value.get("results")).add(mapper.valueToTree(result));
  }
{
  "data": {
    "email": "John@test.com",
    "age": 19
  },
  "results": []
}

Yeah I think thats ok way to do if you know that your workflow data includes a field “data” and you want to overwrite it with the activity result.

By default (per spec) you should merge to the root of your workflow data json,
you can specify in your action data filter for example:(specification/specification.md at main · serverlessworkflow/specification · GitHub)

"actionDataFilter": {
   "toStateData": ".a.b.c"
}

where .a.b.c is an expression (jq by default) that resolveas to an element in the wf data where the activity results should be merged into (if the field does not exist, it should be created first). So yeah it’s more complex than what’s in our sample now. Need to work on it.

1 Like

Hi Tihomir, I have a Temporal Kopgito app that i have implemented with DSL Serverless workflows. It has a parent workflow and 3 child workflows. I want my parent JSON to control which child workflow runs without making changes to the code. I only want the changes to be made in the JSON file. Firstly is this possible? And if yes how could I achieve this?