Tying to finish what i hoped would be a one day project before heading off on holiday. Risked coming out of my comfort zone at server level into app connect.
Hit a roadblock right at the end
So here is a scenario (simplified)
I have .js code like this:
const id = 'ID_3;
const parent='PA_2";
const index = 2;
On the content page i have a variable
to which i want to assign an object from the javascript
const DataObject = {
id: id,
parent:parent,
index: index
};
so i have tried this (and a few other variations
const DataObject = {
id: id,
parent:parent,
index: index
};
const DataString = JSON.stringify(DataObject);
const newData = JSON.parse(DataString);
dmx.parse(mydata.setValue(newData)");
when run, i see in the console for dmx.app.data.content.mydata
{
"$type": "value",
"value": null
}
I was expecting to see an object
{"id":"ID_3","parent":"PA_2","index":2}
i want to be able to address the function output with
mydate.id, mydate.parent and mydata.index
Anyone see where i am going wrong?