Finding Userfield Custom Name for 'Add user to group through User Custom Field'

Hi Andy!

One of our hosted customers also recently asked a question about how exactly to configure the Add user to group through User Custom Field automation. I’m putting a generic version of the answer here for the benefit of our wider ecosystem, as the UX is admittedly not very friendly at the moment - apologies for that while we work to improve it.

How to set up the Add user to group through User Custom Field Automation script

First you need to create a user field from Customize → User Fields (of type Dropdown per the above discussion), then figure out the UserCustomField name (as opposed to the UserField name which is the “template” for the field), and point the Automation script to that field name.

To unpack the related part of the data model: the Admin → Customize → User Fields view shows a list of UserField records (ie. “user field templates”). When you create a record here, users will subsequently be able to choose a value for that when they signup or from their profile. That value will be stored as a new UserCustomField record (ie. “user field instances”, or “actual user fields for users”) linked to the particular User ID, and this record in turn has a synthethic name constructed as user_field_#{user_field_id}.

That is, suppose your new UserField has a name of Another UserField:

(you can see this JSON view from /admin/customize/user_fields.json for your site)

Look for the record with the name of your UserField, and observe its ID, and add that to user_field_NUMBER to get the name value that the UserCustomFields will take, and that is what you need to configure in the User Custom Field value in the script.

Apologies for the carnage; these are provisional instructions until we improve the UX.