Hi!
Rocket.Chat 0.74.2
I want to add new fields in the user profile for input and display (for example: department and city) How can I do it?
Also I want to add new fields in registration form
I’m new here and it seems like a lot of messages never get a response. Most likely someone will tell you to see the [sparse] documentation https://rocket.chat/docs/administrator-guides/custom-fields/
So you need to create a json file with fields you want. The key step is using tabs to indent the elements. It will likely just not work. without an error message. These are field I just added to my site for educators.
{
"affiliation": {
"type": "text",
"required": true,
"minLength": 2,
"maxLength": 80
},
"role": {
"type": "select",
"defaultValue": "teacher",
"options": ["teacher","technologist","support","librarian","administration","consultant"],
"required": true,
"modifyRecordField": {
"array": true,
"field": "roles"
}
},
"twitter": {
"type": "text",
"required": false,
"minLength": 2,
"maxLength": 20
}
}
You should verify your json first using something like https://jsonlint.com/ My first attempt failed because I forgot a comma.
So the fields are set up at Administration -> Accounts -> Registration -> Custom Fields
.
Saving these, I was able to have these be part of the front end registration form.
What I did not see in the docs is mention of the Custom Fields to Show in User Info
in Administration -> Accounts
. For my site, I entered:
affiliation,role,twitter
But the fields/values are not showing up in user profiles. At this point I don’t think the custom fields are fully functional.
It would be nice to have a better understanding if this feature is fully operational.
If the display part isn’t working in 2.1 for sure open an issue with details
I checked it and the “Custom Fields to Show in User Info” didn’t display my custom fields until I added "public": true
in JSON definition under Accounts > Registration > Custom Fields
I have the same problem - the fields are not shown in user profiles
I’m unable to get the display part working on the browser. The custom fields do show up on the experimental iOS app, but not on the browser.
The custom fields JSON:
{
"Age": {
"type": "select",
"defaultValue": "Under 18",
"options": ["Under 18", "18 or over"],
"required": true
}
}
And the “Custom Fields to Show in User Info” field: is set to
Age
The documentation also isn’t clear on how to use “public” and “private”. Logically a custom field is either private or public, but it looks like you can set both to true?
{
"Age": {
"type": "select",
"defaultValue": "Under 18",
"options": ["Under 18", "18 or over"],
"required": true,
"private": true,
"public": true
}
}