Java Script to alter one property of a Data Variable

Hello,
I have the following scenario:
I just read from my API a data variable (single record), and it has 4 properties:

id: 1
name: john doe
type:person
category: user

I want to change the type based on the value of app_variable

Example: (pseudo code)
if app_vars.variable = yes
datavar.type = “object”

The result should be:
id: 1
name: john doe
type:object
category: user
(my real data has around 50 properties)

I was trying to do it via a JavaScript, in the output I chosed:


Because the output should be the same type as in the input I chosed in the output:
Data Variable, but I could not set which data variable.
then the output is “incompatible” with my data variable.
any ideas?
Thanks,
Miguel

Hi, if you just want to change one property in your data variable, I would recommend using the “Set data variable” flow function.