Assigning a task

Use case 4 of a 4-part use case series. In this article, you'll learn how to assign a task to some role in your application.

Updated over a week ago

Note: Before we start it's worth mentioning that to complete adding tasks properly, there is a pre-created Task overview page with a data table that contains all our tasks.

Setting up models

For this last use case, make sure to also create a new model called Employee (add properties like 'Name' and 'Password'). We'll be assigning an employee to a task; so create a relation between the models:

1) Go to the data model overview and open the schema view.

2) Find your 'Employee' and 'Task' models.

3) Connect them together so that in the result you have: 'One Employee has many Tasks'

Creating the connection between models

Don't forget to set the permissions properly for the models, since we're not working with live data you can set them to public.

Assigning a new user

To assign a new user, let's go back to the first use case in this series.

1) Go to the page builder and open the New tasks page.

2) This time, make sure that the beta forms are enabled this allows us to create the assign functionality more easily.

3) Delete your old create form and drag the new create form on the page.

From components

4) A pop-up appears in which we have to select the Task model.

5) We can now (if the relation has been created properly) select not only our properties as we did in the first use case but also an employee.

6) Click on Save to save the new form.

Configuring the form component by adding model's properties

The employee, by default, is selected via their ID. Ideally, we select this via an employee's name, to do this select the autocomplete component. You can now find the option 'Label for options' and select the employee, then choose the name and press Select to use an employee's name instead of his ID when assigning tasks.

Choosing the label for options

When you run the application by clicking on the play button in the top-left corner, you'll likely encounter an error.

Before trying out if the form works, for this example, let's disable the permissions for the action behind the form. To do this go select the form itself and click on the 'Edit permissions' next to the action option.

Editing permissions in the create form action

Here we can disable the private action button.

Disabling the private action

Did this answer your question?