How to implement object mapping with input parameter mapping while adding attributes to the object

var user = {“name”:“Tom”}
input mapping
source target
user tempUser
10 tempUser.age
If you configure tempUser in this way, it looks like this。
{“age”:10}
How to configure such tempUser data if needed
{
“name”: “Tom”,
“age”: 10
}

Hi @bugbugmaker - apologies, but I don’t quite understand your question. It sounds like you want to map an existing variable to a new variable and add a new property to the new variable? If so, I would suggest an approach like this:

The above is just an example. In reality, there may be many attributes for a user, and it is not possible to map all attributes one by one. Therefore, we hope to first map the object and then add attributes to the object

@bugbugmaker Use worker to map the object using Mapstruct

I want to implement this function through Zeebe’s input mapping, hoping to avoid additional development work

@nathan.loding could you give me some help?

The only other alternative I’m aware of is using the context merge() FEEL function, which is documented here: Context functions | Camunda Platform 8 Docs

You’d do something like:

=context merge([user, { age: 10, anotherProperty: "a", yetAnotherProp: "b" }])

Hopefully that works!

Thank you. I appreciate your help.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.