Use dynamic keys in context

Hello!

I’m trying to use dynamic keys in my context but it seems like whatever I do it just tries to make a string of whatever I put as the key.

Here is a simplification of what I am trying to do. I have the variable “myId”:“123456789”, and then I’m trying to create a context using this, like so:

{myId: “here is a string relating to the id”}

What I would expect is:
{“123456789”: “here is a string relating to the id”}

But what actually happens is:
{“myId”: “here is a string relating to the id”}

Is dynamic keys simply not possible using FEEL expression, or is there a way to make this work? I’m not able to find any solution in the documentation or in the forum on this.

Thank you for your time!

Hi @vorbrom - you want to use the context put function. To access an entry in a context with a variable, you would use the get value function.

Here’s a demo in the FEEL playground.