The Type definitions for each of the Entities that support custom fields have been retrofitted to include two additional fields for retrieving custom fields for the entity:
customFields
: This field returns an array of all the custom fields that are set on a given Entity.customField
: This field requires a name argument and lets you retrieve a custom field by name for a given Entity.
GraphQL Queries for retrieving custom fields from Entities
The following queries retrieve custom fields for different entities (e.g., ForumTopic, Community):
customFieldsEntityDefinition
The customFieldsEntityDefinition
query fetches custom fields for the given entity type. Here is an example:
fragment CustomFieldEntityDefinitionView on CustomFieldsEntityDefinition {
__typename
type
customFieldNames
}
fragment CustomFieldsEntityDefinitionResult on CustomFieldsEntityDefinitionResource {
__typename
definition {
...CustomFieldEntityDefinitionView
}
lastUpdatedTime
localOverride
}
query CustomFieldContainerDefinition($entityType: EntityType!) {
customFieldsEntityDefinition(entityType: $entityType) {
...CustomFieldsEntityDefinitionResult
}
}
{
"entityType": "FORUM_TOPIC"
}
customFieldsEntityDefinition
The customFieldsEntityDefinitions
query fetches custom fields for the given list of entity types. Here is an example:
fragment CustomFieldEntityDefinitionView on CustomFieldsEntityDefinition {
__typename
type
customFieldNames
}
fragment CustomFieldsEntityDefinitionResult on CustomFieldsEntityDefinitionResource {
__typename
definition {
...CustomFieldEntityDefinitionView
}
lastUpdatedTime
localOverride
}
query FieldsEntityDefinitions($entityTypes: [EntityType!]) {
customFieldsEntityDefinitions(entityTypes: $entityTypes) {
...CustomFieldsEntityDefinitionResult
}
}
{
"entityTypes": [
"FORUM_TOPIC",
"COMMUNITY"
]
}
GraphQL Types that you can retrieve custom fields from
The following GraphQL Types have the two fields listed above (customFields
and customField
):
- User
- Community
- Category
- GroupHub
- Forum
- Blog
- Tkb
- Idea
- Occasion
- ForumTopicMessage
- ForumReplyMessage
- BlogTopicMessage
- BlogReplyMessage
- TkbTopicMessage
- TkbReplyMessage
- IdeaTopicMessage
- IdeaReplyMessage
- OccasionTopicMessage
- OccasionReplyMessage
- Case
ATLAS
Comments