How to have a Form Automatically Set a Relationship
Last updated
Last updated
Sometimes when you have a form that creates a new record like a Trip, you want some values of the new Trip to be set automatically, like who created the Trip and its status. You can do this by adding those properties be "Set Automatically" in the Fields section of the left panel when configuring your form.
However, if Status is not a text field, but rather a Relationship to another Collection, it requires a different setup to get the related record to be available on your form screen. This can be used many different ways, but in the example below we will be creating a Trip and want to set the Trip Status of all new Trips to Draft by default when they are created. We have already created a Collection of Trip Statuses and added the Relationship of Trip Status to Trips. Now we can set this up using the steps below.
With the component, such as a button selected, select the overflow menu and Make List
Select List and in the setup you will choose the Collection. In this example, it will be a List of Trip Statuses.
Now we will Filter the List so only 1 item appears. In this example, our List will only show Draft. This will send the Draft Record in the Trip Status Collection to the screen where we will create the new Trip.
If you manually type in the Filter, remember that it is case sensitive. You can also do this by the RecordID or any other Column depending on your setup.
Link to a separate Screen where your Form that creates the new Trip Record will be. It will show that it is sending the Current Trip Status to the linked screen and it will be in the Available Data of that Screen.
Navigate to and select the page that your button is linked to and add a Form to Create the New Record. In this Example it is a Create a New Trip.
Here you will setup the Form by adding the desired Form Fields and Set Automatically sections of the component. When you add Trip Status, it will default to Current Trip Status which we brought over from the List on our previous Screen.
Now, whenever you make a new Trip, it will automatically set the Trip Status Relationship to Draft.