Which function do we use to remove a particular field from a record before persisting it?
For example:
recordType!sampleRecord1( id: null, column1: A, column2: B, column3: C, column4: D, column5: E, column6: F, column7: G, column8: H, relationA: recordType!relationA( id: null, column1: A1, column2: B2, column3: C3 )) I want to remove the id field from both sampleRecord1 and relationA before persisting them.
Reason: The downstream database does not handle id: null well, but if the field is missing or field have a value, it works fine.
The output I want to save should be:
recordType!sampleRecord1( column1: A, column2: B, column3: C, column4: D, column5: E, column6: F, column7: G, column8: H, relationA: recordType!relationA( column1: A1, column2: B2, column3: C3 ))
Which function do we use to achieve this? i want to handle it dynamically rather mapping individual fields and then persisting .
Discussion posts and replies are publicly visible
I do not know of a way to "remove" a already populated field from a record.
I tried to cast it to a map, set the ID to null, and cast it back to the record, but this did not help.
Hijacking your top comment to add, thanks to the clarification provided by Sarathkumar down-thread, we can actually use the remove() function to remove named properties (to include record fields), as opposed to just array indexes, which I somehow never realized / never thought to try.
(nice, it also works with a list of property names...)