This article explains how to use relationship fields to define data-rich many-to-many relationships in Zendesk for tickets and custom objects.

What's my plan?
All Suites Professional, Enterprise, or Enterprise Plus
Support Enterprise

Summary: ◀▼

You can create many-to-many relationships between tickets and custom objects using multi-lookup fields or junction objects with parent-child fields. This setup helps manage complex associations like multiple assets assigned to multiple employees. You can view these relationships in ticket fields or related object records, improving data organization and visibility for support teams managing interconnected records such as assets and users.

Within Zendesk Support, you can use lookup relationship fields to create many-to-one relationships between objects. However, there are many scenarios that would be more accurately represented by a many-to-many relationship. For example:
  • Employees might be assigned multiple assets and an individual asset might be assigned to multiple employees.
  • Multiple assets might be associated with an individual ticket and multiple tickets could be opened for a single asset.

This article explains how to use relationship fields to define data-rich many-to-many relationships in Zendesk for tickets and custom objects.

This article includes the following topics:
  • Creating many-to-many relationships with tickets
  • Creating many-to-many relationships with other objects
  • Viewing many-to-many relationships

Creating many-to-many relationships with tickets

Creating many-to-many relationships for tickets is as simple as adding a custom multi-lookup field. Before creating a multi-lookup field, review the considerations and best practices.

To create many-to-many relationships with tickets
  1. In Admin Center, click Objects and rules in the sidebar, then select Tickets > Fields.
  2. Click Add field.
  3. From the list of field types, select Multi-lookup.
  4. Enter a Display name.

    When naming custom fields, don't use reserved system or feature names such as "channel." These names are reserved by Zendesk and won't work in custom fields.

  5. (Optional) Enter a Description for the custom field. This is visible to admins only.
  6. Under Permissions, select an option:
    • Agents can edit: Only agents can view and edit the field. It appears in tickets.
    • Customers can edit: Agents and end users can view and edit the field. It appears in tickets and in the support request form in the help center.
    • Customers can view: Agents can view and edit the field. End users can only view the field. It appears in tickets and on end users' requests, but isn't included in the support request form in the help center.

    For a single ticket form, the new field automatically appears in your ticket form. If you use multiple ticket forms, you'll have to manually add the field to any ticket forms you'd like to include it in.

  7. Under Related object, select the standard or custom object you want to relate to tickets.

    Each multi-lookup field can have a maximum of 20 related objects.

  8. (Optional) Click Add filter to define one or more filters to reduce the number of options the field can display.

    You can filter objects by any number of tags or custom fields. For more information, see Filtering relationship field options.

  9. Click Save.

Creating many-to-many relationships with other objects

To create custom many-to-many relationships between objects other than tickets, you must use a custom object with parent-child relationship fields. This is accomplished through the creation of an object that is used as an intermediary or junction object. Specifically, you must take the following steps to build this sort of relational model.

To create many-to-many relationships using custom objects
  1. Identify the two objects you want to build a many-to-many relationship between. Think of these as the primary objects.
  2. Create an intermediary custom object (the junction object) with two parent-child relationship fields, one pointing to the first primary object and another pointing to the second primary object, as well as any other custom fields you might want.
  3. Create records for the junction object.

    The records will be visible as related under both primary objects.

Example: Creating many-to-many relationships for non-ticket objects

There are a variety of valuable use cases for complex many-to-many relationships between objects in Zendesk. This topic uses the example of an IT team managing assets assigned to employees to demonstrate how to configure many-to-many relationships between objects other than tickets. In this scenario, employees are typically assigned to multiple assets and some assets can be assigned to more than one user at a time.

Step 1: Identify the primary objects

In this scenario, the two primary objects are User and Asset.

Users is a standard Zendesk object that records users in all roles for the account. In this case, we'll focus on the user records associated with the employees. User records consist of standard fields, such as name, email, and phone, as well as any other custom user fields that admins created, such as preferred communication channel or designation.

Asset is a custom object created by an admin with the following fields:
  • Asset name: A text field with the name of the asset.
  • Serial number: A text field used to record serial numbers associated with hardware assets.
  • Product type: A drop-down field with the following options: Hardware, Software, and Subscription.
  • Purchase date: A date field that reflects when the asset was acquired.
  • Warranty expiration: A date field that reflects when the warranty for the asset expires.

For the purposes of this example, user records and asset records already exist. If they didn't, an admin could use the data importer to bulk import records.

Step 2: Create the junction object

In this scenario, the junction object is used to connect multiple users and assets. This is accomplished by adding at least two lookup relationship fields to the object, one connecting to each of the primary objects.

To create the asset assignment junction object
  1. In Admin Center, click Objects and rules in the sidebar, then select Custom objects > Objects.
  2. Click Create object.
  3. Enter the following information:
    • Name: Asset assignment
    • Plural display name: Asset assignments
    • Object key: asset_assignment
    • (Optional) Description: A junction object to relate many users and many assets.
  4. Click Create object.
  5. Open the custom object's Name field (field key standard::name), and make the following changesL
    • Change the Name to Assignment ID.
    • Under Record name type, select Name records with autonumbering, and enter a Prefix of Assignment#and a Starting number of 0000001.
    Note: Record naming settings can't be changed after records are created for the custom object.
  6. Click the Fields tab and click Add field to add the following custom fields to the object.
    • Select Parent-child. Set the Name to Employee and under Select a parent object, select User.
    • Select Parent-child. Set the Name to Asset and under Select the parent object, select Assets. You can also choose to inherit the User record’s permissions, which ensures that you can only see assignments for Assets you have access to.
    • Select Date and set the Name to Start date. Optionally, add the following description: The date the asset was assigned.
    • Select Date and set the Name to End date. Optionally, add the following description: The date the assignment ends.
    • Select Multi-line and set the Name to Notes. Optionally, add the following description: A multi-line text field for agents to capture additional information about the assignment.

Step 3: Add records to the junction object

To build out the relationships between assets and employees, you'll create asset assignment records. Because of the lookup relationship fields, the data in the asset assignment records is visible in the related object's records, too. In this case, an employee's profile will list all assigned assets and an asset record will list all assigned employees.

For the purposes of this example, we're going to add asset assignment records involving two agents (William Carlton and Harper Yoshimoto) and three assets (A001, A002, and A003).

To add asset assignment records for an employee
  1. In Support, click Custom objects () in the sidebar.
  2. Select the Asset assignment object.
  3. On the Asset assignment list, click Add.
  4. Enter the following information, clicking Add to save each record, and then Add to initiate the creation of the next.

    The record names are autonumbered, so they won't be editable.

    Assignment ID: Assignment#0000094
    • Employee: Select William Carlton.
    • Asset: Select A001.
    • Start date: Select 08/05/2022.
    • Notes: Enter New employee
    Assignment ID: Assignment#0000096
    • Employee: Select William Carlton.
    • Asset: Select A003.
    • Start date: Select 08/05/2022.
    • Notes: Enter New employee.
    Assignment ID: Assignment#0000095
    • Employee: Select Harper Yoshimoto.
    • Asset: Select A002.
    • Start date: Select 10/19/2024.
    • End date: Select 04/19/2025.
    • Notes: Enter New temporary employee.
    Assignment ID: Assignment#0000097
    • Employee: Select Harper Yoshimoto.
    • Asset: Select A003.
    • Start date: Select 10/19/2024.
    • End date: Select 04/19/2025.
    • Notes: Enter New temporary employee.

Viewing many-to-many relationships

To view many-to-many relationships for tickets, open a ticket and review the values selected for the multi-lookup fields.

To view many-to-many relationships defined through a junction object, you can open the junction object's records, or records for either of the parent objects defined in the junction object's parent-child fields. Using the same example as above, after creating the asset assignment records, you can view the related asset, employee, and asset assignment records in the following ways:
  • User profiles: The Related tab of an employee's profile will contain a list of assigned assets.
  • Asset records: An asset's record will contain a list of employees it's assigned to.
  • Asset assignment records: An asset assignment record will list both the employee and asset assigned.
In this example, the following related records would be visible:
  • On William Carlton's profile page, the Related tab displays two asset assignment records: Assignment#0000094 and Assignment#0000096.

  • On Harper Yoshimoto's profile page, the Related tab displays two asset assignment records: Assignment#0000095 and Assignment#0000097.

  • The A001 asset record displays one asset assignment record (Assignment#0000094), which is listed as assigned to William Carlton.

  • The A002 asset record displays one asset assignment record (Assignment#0000095), which is listed as assigned to Harper Yoshimoto.

  • The A003 asset record displays two asset assignment records: Assignment#0000096 and Assignment#0000097 with assignments to both William Carlton and Harper Yoshimoto.

Note: If a user or asset record is deleted, any related asset assignment records are deleted automatically.
Powered by Zendesk