In this tutorial, you'll learn how to tag a user using a trigger. You will also find if a tag was added by a trigger.
The workflow includes the steps below.
- Step 1: Create a custom user field
- Step 2: Create a trigger
- Step 3: Verify if a user tag was added by a trigger
Using a trigger action, you can't directly add user tags to the profile of a user. As a workaround, create a custom workflow using this action: Requester | Custom user field, which will then add a tag.
Step 1: Create a custom user field
- Create a custom user field select the drop-down field type
- Add the user field values with tags. This example adds the
vip
user tag - Click Save
Step 2: Create a trigger
- Create a trigger
- Add the ticket conditions for your user tag
- Under Actions, add Lookup relationships > Requester > Your custom user field | Select the user field value
- Click Save
The trigger adds the vip
tag to the user and any subsequent tickets from that user.
Step 3: Verify if a user tag was added by a trigger
Use the below steps to verify if a user tag has been added by a trigger.
- Go to Admin Center > People > User fields > Open your user field, and locate the digits right after the Custom field ID at the top of the page
- Use the URL below and replace
fieldID
with the user field ID found in point 1, and your Zendesk subdomain instead ofyoursubdomain
https://yoursubdomain.zendesk.com/api/v2/user_fields/fieldID
In the results, note the numerical value that will appear after"id"
- Using this URL below, replace
yoursubdomain
with your actual Zendesk subdomain:https://yoursubdomain.zendesk.com/api/v2/triggers/active.json?active=true&page=1
- On that page, look for the value ID from point 2 in the trigger list
The name of the trigger will appear, along with the custom user field value and tag:
6 comments
Support Admin
Sorry, but I am not seeing how this adds a tag to the user profile. Are some steps missing?
My use case (as it is for many others) is to trigger off the user tag to assign a user to user segment (which only works off tags, and not any other fields), for example, to control visibility to articles.
How can automatically add a tag to the user profile?
0
Christine Diego
Unfortunately, there's no trigger action that will allow you to add tags on the user profile. Tags are added to tickets via triggers. Have you created the custom user field as mentioned on the article and trigger? Please take note that the trigger will fire when a ticket has been created.
0
Support Admin
Hello @...,
No, I did not try the custom field approach because it won't work for assigning a user to a user segment. That assignment is only based on "real" tags (no support for user fields). In other words, this method doesn't accomplish what the title says.
All this method does is to provide a way to initiate a trigger based on a custom user field (sort of the wrong direction ;-) ).
So is there another way to add a user to a user segment via a trigger?
0
Christine Diego
At the moment, there's no trigger action that can add a tag on the user profile, however you can use the custom user field option and use it on the trigger to add a user tag on the user profile. The trigger will add the tag to the user and any subsequent tickets from that user.
You can also post this as a feature request in feedback forum. Our Product Team reviews this forum regularly and it has inspired many of the enhancements we've made to Zendesk over the years.
0
Victoria Thrash
@... the issue is that triggers only work when there is a ticket. we need to be able to update users regardless if there is a ticket.
1
Alik Fedorenko
We are also running into the need to automatically tag users when an organization is assigned to a user.
0