Track Which User Last Updated a Record

In this article, we will guide you through the necessary steps to create a workflow that enables you to track the user who made the most recent update to a record.

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 was last to update a record.

Scenario

You have developed an application for efficiently managing sales leads. Your dedicated team of Sales Representatives consistently update the lead records.

As part of your system, you aim to monitor and track the user responsible for the latest update on each lead.

Requirements

The following are the requirements for implementing this worflow:

  • Your database includes a table that stores records that you want your users to be able to update. In this example, these records are referred to as 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. 

  • Your page has a form that either adds or edits a record.

 

Steps

1.  Add a "Last Updated By" Connection Field


From the Data section of your Builder, click on the table where you want to track the "Last Updated By" connection. 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. To incorporate the new connection field, simply add a new field from the right panel in your table:

trackuser6

 

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

trackuser2

 

The relationship type should be the default type of one-to-many:

trackuser3

Tip: To learn more about connection types, see our article here

 

 

2.  Add a Record Rule to Automatically Update the Connection Field


Navigate to the Pages section of your Builder and locate the page that includes the form used by users to add or edit the record. Click on the "Rules" option for that form and then select the “Record Rules” option.

trackuser5

 

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" field to the logged-in Sales Rep.

trackusers6

Additionally, if you have multiple forms in your application where users can add or edit records, it is important to note that you will need to add the same rule to those forms as well. This ensures that the "Last Updated By" connection field is updated correctly across all forms.

Note: If the logged-in role option is not visible, it indicates that the login settings for this page do not permit access for the specific role (Sales Rep). You can modify your login view to ensure that the Sales Rep role is granted access to this page.

To learn more about managing roles and permissions, see our article here.

 

Congratulations! You have now successfully configured a workflow using record rules, logins, and connections.