Contentful logo

Contentful Community

Pass search filter to MultipleEntryReferenceEditor

I want to restrict entries that can be linked in an entry further and without user input. It should be based on what entry im currently on and if that is referenced in the entry to be linked.

When clicking the “add existing content” button the MultipleEntryReferenceEditor opens with the “search for an entry” field

Target state:

How can i modify this? i have an app on Field with the following code:

  const handleClick = (sdk: FieldExtensionSDK) => {
    .then((arrayOfSelectedEntries) => setSelectedEntries(arrayOfSelectedEntries as Object[]));

  return (
      <Button onClick={() => handleClick(props.sdk)} buttonType="primary">Add Products</Button>
      {/* <EntityList>
        { => {
          return <Paragraph>{JSON.stringify(e)}</Paragraph>
      </EntityList> */}

      {/* <Paragraph>Related products; {JSON.stringify(props.sdk.entry.fields)}</Paragraph> */}
      parameters={{instance: { showCreateEntityAction: true, showLinkEntityAction: true}}}

This opens the setSelectedEntries in 2 ways. through the button or via MultipleEntryReferenceEditor. But now im lost.

@mikael.orn were you able to figure this out? We’re running into the same issue