Dropdown options based on the user access/role #15317
-
Describe the feature request Is there any way to achieve this? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hey @KKshitiz This is super fun, because it involves some of the new v3 features! Firstly, in the Data Tab, under Manage Roles, I've created the role of "Sales", which I think you've already done. I've thrown together a quick stock-take of my shop This is where it starts to get fun: Click "Create a view" and name it something relevant. In the view, set the Access to the Sales role, and set the availability to Read Only (you may also wish to set other columns as read only). What we've done so far means that component that accepts a data source (Data Provider, Table, Repeater Block, etc) will see the Sales_View as a data source as well. If you create a page that is specific to Sales, and use the Sales View there, anyone on your sales team will be presented with that view, and those permissions accordingly. In the screenshot above they can edit the name and price of each item, but the availability is read only. The next step is to create a Row Action from within the sales_view: I've named mine "set_as_available" - once you're happy with the name you will be taken to the Automations tab, where you have the beginnings of a Row Action automation. Add an Update Row step to the automation, use the trigger.id to specify which row you're updating, and set the availability to "Available" You can then head back to the Sales view and create another row-action to save as Reserved in much the same way. When you compare youre main table (in my case "items") to the sales view, you will be able to select which row-actions are available for the view, so that you can customise your data further (for example if you had additional actions that the accounting department, or the warehouse needed to make). Now, finally, onto the Design section, create a blank screen, and add a Table component. You should see the view you created in the list of Data Sources: Selecting this should mean that your availability column is visible but not editable (read only). Near the bottom of the Settings panel of the table you will see "Buttons" - click "Add button" and add both buttons corresponding to the Row Actions you just created. You may also wish to dress these buttons a little more - you can do this by clicking the cog/gear/sprocket icon. Finally, you should go to Preview you app, and select "View as Sales" along the top You can now click the Available, and Reserved buttons freely, and see the availability status immediately reflect in the table, but you cannot set these as Sold in the Single Select column. You may also wish to add other actions to the buttons, such as a "Continue If/Stop If" action to prevent Sales from marking a Sold item as Available" As always, I've attached the app-export so you can take a closer look, you can download it here: If you're unsure how to import an app you can read more in the documentation here. If you have any further questions I'd be happy to help. If you have not already, you might also want to join our Discord community server |
Beta Was this translation helpful? Give feedback.
Hey @KKshitiz
This is super fun, because it involves some of the new v3 features!
Firstly, in the Data Tab, under Manage Roles, I've created the role of "Sales", which I think you've already done.
I've thrown together a quick stock-take of my shop
This is where it starts to get fun: Click "Create a view" and name it something relevant.
In the view, set the Access to the Sales role, and set the availability to Read Only (you may also wish to set other columns as read only).
What we've done so far means that component that accepts a data source (Data Provider, Table, Repeater Block, etc) will see the Sales_View as a data source as well. If you create a page that is specific to Sales, an…