Table of Contents

Track Which User Last Updated a Record

Lesley Updated by Lesley

When an app has numerous users, it may become necessary to track who created a record or last updated a record. By combining connections with logins and record rules, you can automatically log which user record last updated a record.

Scenario

You have an app for managing sales leads. Your team of Sales Rep users is constantly updating lead records. You want to track which user last updated a lead.

Requirements

The following are requirements for adding this recipe:

  • Your database has a table that stores records you want your users to update. In this example, these are leads.
  • Your app has user logins activated. The settings allow you to have logins for different user roles.
  • You have a page protected with a login for your users to log in and access. This could be a user role, like Sales Reps in this example.
  • Your page has a form that either adds or edits a record.

Recipe

  1. Add a Last Updated By connection field

From the Data section of your Builder, click on the table where you want track the Last Updated By. In this example, it is a Leads table.

Last Updated By needs to be a connection field to the user role that submits the forms. Add a new connection from the right panel in your table:

When prompted to select the table, select the user role you would like to track. In this example, it is a Sales Rep role:

The relationship type should be one-to-many:

  1. Add a record rule to automatically update the connection field

From the Pages section of your Builder, find the page that contains the form the users use to either add or edit the record. Click on the "Rules" option for that form, then select the “Record Rules” option.

Add a new rule by clicking the “Add Rule” button. For every form submission, this rule is going to update this record and set the value of Last Updated By to the logged-in Sales Rep.

If you don’t see the logged-in role option, it means that the login for this page does not allow that specific role (Sales Rep) to access the page. Update your login view and make sure the Sales Rep is allowed to access this page.

Notes and Troubleshooting

The rule you just added applies to this form only. If you have other forms where your users add/edit records, you will need to add the same rule to those forms as well.

How did we do?

Use an Edit Form to Create Records If They Don't Exist

Copy a Record Using Record Rules

Contact