Thomas,
You could have an enumeration attribute on the products that would keep track of which retailer it is for. Then you can use that for conditional visibility. For more info on this you can refer to https://docs.mendix.com/howto40/set-up-visibility-and-editability-based-on-an-enumeration
There's a few ways to do this, but it depends on what you do want them to see. You should probably go with a database constraint on the products that a retailer can see. Limit them to only those that they sell.
Hello Thomas,
Nicholas proposes a quick and simple solution. However, you should be aware that although users won't see this information in the form due to the conditional visibility, they can still access it. Any tech savy individual could issue an ajax request and get data on all invoices on your website. This is certanly something you do not want to allow.
IOP what Marc suggest-using Xpath contraints to limit acces to data is the right approach.
I have put together a minimal working example for you in the screnshot. Generally, you want to have an association (sometimes a generalization) to the Administration.Account user. You can than compare this to the '[%Currentuser%]' to determine visibility.
The beauty of this approach is that once you have the XPath constraints in place you don't need any conditional visiblity in your forms.
I hope this answer helps,
Andrej
Hi Thomas, the approaches told above are common practise but if your problem statement is not a mock project and for a real project, then each has a drawback. Enum or boolean flag will restrict only on UI. And Xpath based on logged in supplier is too constrained e.g. As a siteadmin not retailer it will be difficult for me to query the invoice. So a 3rd approach is needed via domain model. Described below.
Order and Retailer and Product - all 3 should be referenced from each Lineitem. Each Lineitem creates its own Financial entity with fields such as unit price, discount, tax, subtotal before tax, paid, savings, rebates etc.
So if an order has 2 products 1 and 2 belonging to Retailers A and B -> then create 2 Lineitem. One link to Order, Product 1 and Retailer A. And other to Order, Product2 and Retailer B. Now in the Invoice have a grid populated by microflow to get the LineItems based on which retailers are needed in this context. If based on logged in user, or based on his role or purpose of view e.g. calculation or payment etc.
Hello everyone,
I want to thank you all for taking the time to answer my question.
I'll definitly use them and try them out!