Skip to main content

Custom Profile Fields

Custom profile fields allow you to provide any arbitrary attribute for the members of your community.

Below we're going to explain how to retrieve, add, reorder, archive, unarchive, or delete a custom profile field. In case you want to update member's custom profile fields, you can check the updateMember tutorial.

Retrieve Custom Fields#

The custom fields are accessible through the memberFields of a network.

{
network {
memberFields {
fields {
key
name
archived
}
}
}
}

Add Custom Field#

addMemberSchemaField mutation is used to create a new custom field on the network level. It takes CustomFieldSchemaInput as an input. The key is used to uniquely identify the field.

mutation {
addMemberSchemaField(input: { type: text, name: "Website", key: "website" }) {
id
}
}

This will create a new custom fields on the network then you can update the value of this field for each member.

Update Custom Field#

You can use the updateMemberSchemaField mutation to update a custom field. It takes UpdateCustomFieldSchemaInput as an input. The key is used to uniquely identify the field.

mutation {
updateMemberSchemaField(
input: { key: "website", description: "Your personal website" }
) {
id
}
}

Archive Custom Field#

You can use the archiveMemberSchemaField mutation to archive a custom field. It takes a key as an input to uniquely identify the field.

note

Archiving a custom field preserves the existing values and can be restored by unarchiving.

mutation {
archiveMemberSchemaField(key: "website") {
id
}
}

Unarchive Custom Field#

You can use the unArchiveMemberSchemaField mutation to archive a custom field. It takes a key as an input to uniquely identify the field.

note

Unarchiving a custom field restores the existing values for that field.

mutation {
unArchiveMemberSchemaField(key: "website") {
id
}
}

Delete Custom Field#

You can use the deleteMemberSchemaField mutation to delete a custom field. It takes a key as an input to uniquely identify the field.

note

Deleting a custom field deletes all the existing values for that field.

mutation {
deleteMemberSchemaField(key: "website") {
id
}
}

Reorder Custom Field#

You can use the reorderMemberSchemaFields mutation to give a custom order to the custom fields.

mutation {
reorderMemberSchemaFields(
input: [{ key: "website", index: 1 }, { key: "birthday", index: 2 }]
) {
id
}
}