Listing entries assigned to a specific user

Make sure to check out this course on GravityKit Academy on Advanced User Management and CRM Functionality, which covers a similar use case to this article.

If you are using Gravity Flow's Assignee field, then please check this other article instead.

It's pretty easy to only display entries created by the currently logged-in user on GravityView by using our Advanced Filters. 

But what if you want to display entries assigned to the currently logged-in user who did not create the entries?

In this short tutorial, we'll find out how to display a nice drop-down field on your form to list all your WordPress Users, which we can then use to "assign" an entry to another user.

In our example, we'll create a simple form to assign tasks to other users.

Step 1: Preparing our Form

Our form will consist of 4 fields:

  • One name field;
  • One email field;
  • One drop-down field, which will dynamically populate with your WordPress Users;
  • And a paragraph field for the task description.

Form to assign a task with fields for name, email, task assignee dropdown, task description, and submit button

To dynamically populate the drop-down field with the WordPress Users of the website, we'll use our free Gravity Forms Dynamic Lookup add-on.

Dynamic field settings form for assigning tasks to WordPress users via dropdown selection

If we preview our form now, we'll see the drop-down automatically populated with the existing WordPress Users. The value of each option (user) is their WordPress user ID. Perfect!

Dropdown menu for task assignment showing user options: Floaty The Astronaut, Rafael Ehlers, Zack Katz

Now, save your form, click on Preview, and assign some test entries to all your WordPress Users. 

Step 2: Creating our View

Let's create a View using the Table View layout, to make it simple for this tutorial:

Table listing tasks assigned to users with names, emails, and task links

As shown in the image above, this View is unfiltered; we see tasks assigned to all users. Now, let's implement a filter on this View using the Advanced Filter extension and the {user} Merge Tag to only display entries assigned to the currently logged-in user:

Filter and Sort settings with dropdown to assign tasks to specific users or custom choice

The {user} Merge Tag will be used to output to the filter the ID of the currently logged-in user. This way, we can compare it against the value of the drop-down field, which contains the user ID of the person to whom the task was assigned.

Assign task to user with specific ID using dropdown and input field

Now, let's log on our website as Floaty and check our assigned tasks:

Assigned tasks table listing names, emails, task assignments, and task details

We strongly recommend you read the article about the {user} Merge Tag, a powerful tool that can be used to retrieve any data from the currently logged-in user, even custom user meta can be used to compare against any form field.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us