Contentful logo

Contentful Community

UI Extension setValue for field.type=Array

Hi community,

I have a React field level UI extension. the field is a multi reference link entry (field.type = Array).
Now, im using the field level sdk and trying the setValue for this field as in the code snippet below.

onChange = async (event: React.ChangeEvent<CheckboxField>) => {

var payload =" [
	{
		sys: {
			type: 'Link',
			linkType: 'Entry',
			id: 'id_of_linked_entry'
		}
	},
	{
		sys: {
			type: 'Link',
			linkType: 'Entry',
			id: 'id_of_linked_entry'
		}
	},
	{
		sys: {
			type: 'Link',
			linkType: 'Entry',
			id: 'id_of_linked_entry'
		}
	}
]"

this.props.sdk.field.setValue(payload).then(console.log("saved")).catch(error => {
console.log("not saved: ",JSON.stringify(error))
});

};

It returns a completely useless error message which tells nothing about the cause.

{"code":"ENTRY UPDATE FAILED","message":"Could not update entry field","data":{}}

Any one who can point to in the right direction? What am i doing wrong here?

Cheers.