Follow

New iframe

This article uses Connections and Record Rules to create a workflow where users can view a record and save it for later viewing.

Scenario

DataBrew has a "Recipes" page where you can share your own crazy coffee brew ideas. Users would like a way to be able to save these recipes so they can try them out at a later time by simply clicking a link.

In this example, we will be building a Favorites feature to allow Users to add Recipe records to their own list of Favorites.

How it looks / See it in action

Users will see a list of records along with a link to Add to Favorites. Once added, users can access their Favorites at any time from a separate page

Recipe

[[TOC]]

1. Create a Favorites Object

In the Database section of the Knack Builder, create a new object called "Favorites" using the +ADD button.

image alt text

_____NEW____

2. Add a Connection pointing to the Original Object

In your newly created Favorites object, add a Connection Field that points to the original object. This original object is the object containing records your Users will favorite. Here we point the connection to the Recipes object

image alt text

3. Add a Connection to the User Role

Add another Connection field to the Favorites object pointing to the User. If you want ALL user roles to have access to the Favorites feature, connect to the User. In this app, only Members have access to the feature:

image alt text

Knack Tip: Notice how there’s no other recipe-related fields? With the single connection, we can display any Recipe field directly from the Favorite record

Here you can find more information to working with connections.

We can delete the Favorites Name field since it won’t store any information. In the end, our Favorites object consists of only 2 fields:

image alt text

Now that the Database setup is complete, it’s time to create a Page that allows the user to favorite specific records.

In this example, we will add a List View to display recipes. The View will contain a link to view more details, where we can use an ‘Edit Recipe’ Form as a trigger to create the Favorite record automatically.

4.1 Add a Records View

Using the Add Page Wizard, add a new page that displays the records that users can favorite (Recipes). You can select any view-type you’d like for the records; we’re using a Table View for this example.

In order for the user to be able to add a new Favorite record, make sure you include the Form to add a connected Favorite.

4.2 Remove the Form Inputs

If you open the Add Favorites Form we just created, you’ll notice that the User connection field is available. This is not ideal for the user who will be submitting the form. We can populate the User field with a Record Rule, therefore let’s remove the inputs from the Form.

From the Inputs tab, remove all the form input fields by hovering over the fields and selecting the "X" icon. This will leave just the submit button on the form.

You will now have no inputs in your Form view.

4.3 Connect the logged-in User with Record Rules

Next From the Form Rules tab, select Record Rules, select Add Rule to add a new record rule to your form.

For this new rule add the following settings:

  • Action: Select "Update this record"

  • When: Leave as "Every form submission".

  • Value: Set your User Role connected to the Favorites object to "the logged-in User Role"

4.4 Change Submit Button Text

We can make this more user-friendly by changing the text from the Form’s Submit button.

From the Options tab, change the Submit Button Text to "Add to Favorites."

Knack Tip: Here you can find more information on Form and Detail views.

5. Create a View of User’s Favorites

Now that users can favorite records, they will want to see which records are on their list of favorites.

Using the Add Page wizard again, add a new Page restricted to the specific User Role. You can use any view-type for this, this example uses a Table View with a link to view more details

Knack Tip: Learn more about showing records connected to the logged in user.

6. Control which fields the User sees for their Favorite

By default, the view is only going to display the 2 Connection Fields present in the Favorites object. To allow you users to see other fields from the original records, add fields from the connected object to the list.

From the Columns tab, select the original object (in this example the Recipes object) to view the fields in that object. Click a field in the list in order to add it to the View.

Your 2 pages should now look exactly like the ones displayed in the How it Looks section!

7. Optional Features

7.1 Adding Notes

What if users to add notes to each record they favorite? This can be done by adding a Paragraph Field to the Favorites Object.

image alt text

Then include this field in the "Add to Favorites" form view, so your form will no longer be blank.

Your users will now be able to add notes when they Favorite a record.image alt text

7.2 Enable the modal popup

With this current setup, the user would be taken to a separate page in order to access the Add to Favorites button. It would be a much smoother process if they could do it directly from the table without having to leave the list.

From the Settings tab of your Details page, enable the option titled Display page in a modal popup

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments

Powered by Zendesk