Multi-reference - Feedback and question

Hello, I just tested the new released mutli-reference feature, and I have a couple of questions. My assumption here is that I have an Item object class and a Selection object class that reference this item as multireference (meaning that one selection can have multiples items). In the app, I listed the items (in an iterative object) and when clicking on it, it’s adding the item into the selection (object Selection cardinality one in the datasource)

  • To add an item into my selection, I didn’t find any way to go to a function and use array.push to add the _id of my object, is there any other better approach ?
  • To remove an item, it’s the same, need to use a function to remove a specific item from the list
  • last but not least, the attribute “items” from my selection is not exposed into graphQL (or, not yet :wink: )

Note that I wanted to keep it simple without creating too many runtime datasource

Working with an additionnal Runtime (cardinality many, object class item) to reference the list of items of my selected selection makes things a bit easier, but still need to use two “steps” to add an item in the list:

  • first add the item into that Runtime items (for selected selection)
  • update the list of items into the selection with all value of the runtime

Hi Jeremy!

Regarding the first two points: Does the key feature number 2 (“add/remove ids”) help? You can use the Value Processor in an Update Object, as in the linked example in bullet # 2 in the below link.

I am not sure about the GraphQL part - will come back with an answer on that!

A quick update on this one:

  1. There guide is correct regarding adding or removing items in the multi-ref list, but there is a bug when you try to clear/remove the last item. Will be patched soon.
  2. GraphQL: If you have the multiref property tags it currently does not appear if you try to list {persons} in GraphQL. This challenge is registered. You must currently specify the name of the property (tags) in the list of properties to return, e.g. {persons {_id, tags}}
1 Like

Hi Kristian, thanks a lot for the quick answer, and sorry for asking something that was clearly mentionned in the doc.
I went too fast in the update object doc (maybe because the Multi cardinaliy - Value processor tab is not shown by default, but I actually have no other good excuse ^^)

So it actually working fine like described with the Value processor (add/remove).
Good to know that it’s already available in GraphQL !
So far so good ! Validated new feature !

1 Like

Ah. I struggle very hard with deleting the last reference… so waiting for the fix.

There is another bug in multi reference.
a product has product* as reference. When clicking on a product I add it to the product* field, by referencing the product(temp)-products* → add selection (product). This unfortunately only works if there are already at least one product referenced, but not if there are no products in the field.

Therefore I need a workaround that checks if empty. If empty I just reference the product (Context), if it is NOT emtpy I take the current value (product temp - products) and add selection (product).

Similar as the problem with deleting the last, just the opposite way.


Can you provide a few screenshots of the setup to make sure we can reproduce it equally?

Sent in a message! … .