Tim_Jones
(Tim Jones)
August 23, 2023, 7:47pm
1
I am getting this error when trying to Deep Save a new row with a relationship to a list of users.
Get the Users -
Deep save a row and add the relationship to Fundraiser and Users
I’ve tried passing userList without the map function, that didn’t work either -
This is the schema -
What am I missing?
Thanks,
Tim
Try removing this - the password
property is never returned from the database.
If this does not help, see if removing the Users
property in the object you save in Deep Save (as a debugging step) to see if it makes any difference.
Tim_Jones
(Tim Jones)
August 23, 2023, 11:18pm
3
Thanks for jumping in @mark-piller !
I removed the password property, no change to the behavior.
I removed the Users property from the deep save object -
The row was inserted without the Users relationship -
Dima
(Dima Vak)
August 24, 2023, 8:17am
4
Could you print userList
and check what is inside?
I’ve tried to reproduce your issue, but everything works fine. So I assume the problem is in the logic.
Tim_Jones
(Tim Jones)
August 24, 2023, 1:56pm
5
You’re right; there is an issue with the logic. But I’m confused about what is happening. I made a test bit of code to demonstrate the problem -
The return of userList contains -
[
{
“___class”: “Users”,
“email”: “ASHLEY@meadowfarms.com ”,
“objectId”: “B83BE765-FA8A-4A16-B200-9A2E8805329D”
},
{
“email”: “tim@meadowfarms.com ”
}
]
My email was added to sendToList, not userList, but userList has been updated. Why is that happening?
Thanks,
Tim
Dima
(Dima Vak)
August 24, 2023, 3:53pm
6
That is how JS works(Codeless built on it)
Here you do not copy the object, but link them.
If you want to copy use Convert to Text + Convert to Object block, and the result will not be linked.
Tim_Jones
(Tim Jones)
August 25, 2023, 1:32pm
7
Oh, interesting. Good to know, I’ve never worked in a language that is like that and this hasn’t come up before. So, the variable is a passed reference, not the actual value. What is the technical term for this?
When you modify a value and assign that to another variable, does that create a modified copy of the values? Or more correctly a new reference to the changed value?
Thanks for your help,
Tim
Hello @Tim_Jones
What is the technical term for this?
Primitive Types and Reference Types in JavaScript
When you modify a value and assign that to another variable, does that create a modified copy of the values? Or more correctly a new reference to the changed value?
Depends on the data type. If it’s a primitive (example: number, boolean, string) then copy. If it’s a reference (example: object, array) then by reference.
Regards
Tim_Jones
(Tim Jones)
August 25, 2023, 1:47pm
9
Can you explain what happens here -
sendToList should not be linked to userList, right?
@Tim_Jones
“Map items” block creates a new array (sendToList) and does not modify (userList).
But for example:
“newList” does not equal to “originList”, but “someObject” is the same to any of the “newList” children.
Tim_Jones
(Tim Jones)
August 25, 2023, 5:58pm
11
Thanks for the example @viktor.liablin .
If, after setting newList, I were to change someObject, propName from 123 to 1234, would that change all newList’s children to 1234?
Tim
Hello @Tim_Jones !
Yes, you’ve got it right – the value of propName
will be 1234
.
Regards,
Alexander
Tim_Jones
(Tim Jones)
August 28, 2023, 2:11pm
13
Thanks! I appreciate that you’ve taken the time to explain this to me.
Best,
Tim