Custom Module - adding items will automatically create properties with type datasource in a module

Hi. Is it possible to add selected items (through create api) into a module which will also creates item properties with datasource field type (item1, item2, item3) automatically?

Selected items i wanted to add:

I wanted to add the selected items here in the custom module with property name and datasource field type (Item1, Item2, Item3, and so on – depending on how many items I selected in the table)

Hi @omamai

You can’t create properties via the create API, however, you could just capture the IDs of those items from the table and add them as a comma-separated list into a text field property.

Then, when rendering that new item, just loop through the array of IDs and look them up via their relevant module component.

This way you can capture as many items as you like with just one property.