Cant select correct reference in reference set selector

Hi everyone, I'm having trouble with my application. I'm trying to create a system for managing orders. Let me explain with my domain model An order has multiple order items, which stores the quantity of the product you're ordering. An order item is associated with 1 product. So on the order page I'm trying to make a reference set selector for order items, but instead of having a select page for the order items, I want to select a product. When I do 'Select entity' in the reference set selector I can't select the product reference. How can I make it so that when I click on 'Select' in the reference set selector, the user is presented with a list of products, can select one and enter the quantity he/she wants to order? Thanks in advance!
2 answers

(in response to comment) As said, your alternative is to make a selection form yourself. It is not hard to set the references you want. For example (and this is just one option), you could show a datagrid in your Order form that shows the products for that order (over xpath), not unlike a reference set selector. Add a button 'order products' (or something along those lines) that takes the user to a product selection page. Instead of an auto-generated selection page, you make a custom page yourself. In this page you can show another datagrid (or listview, whichever works better Ux/styling wise). Here, the user can select the products to order.

Given what you're trying to do, you can open this page via a microflow that also creates (without commit!) an orderItem for each product, and associates it to order and product.

(Note: either I'm reading your model wrong, or you're going to get into trouble if only one orderItem can exist for a product. I'd expect a product can be ordered more than once, by different users, under different orders? In that case the association should be: product 1--x orderItem)

Now you can present a user with a list of products and an input field for quantity. Note that you can set a datagrid column to 'editable', which would be nice for quantity. However, that is only possible if the editable field is an attribute of the listitem (orderItem). So, fill the grid with datasource 'association', from Order (caller of the page) to orderItem. This is possible because you've created (in memory) an association between order, product and the temporary orderItem.

Then make two columns, one containing the product name (over association from orderItem) and one containing 'Quantity'. Add a button with a custom microflow that takes the temporary orderItem files for the Order. For each that has a quantity higher than 0 (the default) you commit the orderItem. It then becomes a database entry that links order and product, including the selected quantity. All orderItems that have quantity 0, you don't commit. They'll be purged from memory automatically.


So, you want to set a reference between Orders and Product, even though no such reference exists in your model?

There's ways around this, obviously, but using a reference set selector you will always only get a set of direct references (OrderItem), not one reference deeper (OrderItem-->Product).

Depending on what you're trying to do, you could adjust your domain model, or make a custom selection form.