NOTE: Sorry found the error it was when trying to refresh it once the data had been uploaded this works as a way for creating one2many data in javascript
Hi,
I’m trying to save a one to many object using a presenter, which calls an API giving me multiple items.
here’s an example of what the data I’m trying to save will look like.
bulkyItems =
[
{itemArea: ‘Garden’, itemDescription: ‘Netball hoop’},
{itemArea: ‘Kitchen’, itemDescription: ‘Cooker’}
]
I have fieldPaths references made from the CASE object to the bulkyItems object:
cs.ref(‘field_item_area’) [REL0000983FEFFC1,REL0000981FEFFC1:PRO0003577FEFFC1]
cs.ref(‘field_item_description’) [REL0000983FEFFC1,REL0000981FEFFC1:PRO0003583FEFFC1]
As I’m trying to create new objects I’m running a for look for bulkyItems and saving each separately using the recordId of the presenter.
for (let item in bulkyItems){
let save_bulky = {};
save_bulky[cs.ref(‘field_item_area’)] = bulkyItems[item].itemArea;
save_bulky[cs.ref(‘field_item_description’)] = bulkyItems[item].itemDescription;
save_bulky[’:id’] = record_id;
mats.save(base_object_id, save_bulky);
}
This seems to create bulkyItems but it doesn’t save any information I can only get the id number of the new items. Whats more I even searched through the recordset and tried to update the fields using cs.set() but once I’m out of the recordset it forgets all the data.
I also get tonnes of these error with search mentioned
08:41:09.7574 Invalid field path passed to record::search() - :PRO0003577FEFFC1. Field belongs to object OBJ0000319FEFFC1, however expected object is OBJ0000198FEFFC1.
the 2 objects mentioned are the case object and the bulky item object.
Does anyone have an idea on where the creation is incorrect?
Thanks