Skip to main content

Custom fields

Custom fields allow you to add additional fields on People, Exhibitors, Plannings (Session), and Product (Items), in order to display more information on pages, create filters, and improve the results of the matchmaking algorithm.

There exists several types of custom fields: Number, Url, Media (picture), Text, LongText, Select (single choice), MultipleSelect (multiple choices), MultipleText, Tree (only for exhibitors), and Date.

Object

Get Custom Fields of an Event

This query can be used to fetch all custom fields set up on the Event.

You can add a TARGET in order to get only custom fields of a specific entity: PEOPLE, EXHIBITORS, PLANNING, or PRODUCT.

  • target - The Entity on which the custom field needs to be created (PEOPLE, EXHIBITOR, SESSION or ITEM)

Query

query AllEventCustomFields($eventId: ID!, $target: FieldDefinitionTargetEnum!) {
event(id: $eventId) {
fieldDefinitions(target: $target) {
... on NumberFieldDefinition {
id
name
}
... on UrlFieldDefinition {
id
name
}
... on MediaFieldDefinition {
id
name
}
... on TextFieldDefinition {
id
name
}
... on LongTextFieldDefinition {
id
name
}
... on SelectFieldDefinition {
id
name
}
... on MultipleSelectFieldDefinition {
id
name
}
... on MultipleTextFieldDefinition {
id
name
}
... on TreeFieldDefinition {
id
name
}
... on DateFieldDefinition {
id
name
}
}
}
}

Variables

{
"eventId": "RXZlbnRfMQ==",
"target": "EXHIBITORS"
}

Get all values of a single or multiple choices Custom Field on the Event

This query can be used to fetch all values of a single or multiple choices custom field setup on the Event in Swapcard.

Arguments

  • eventId - The Id of the Event on which the custom field needs to be created.

Query

query EventCustomFields($eventId: ID!) {
event(id: $eventId) {
fieldDefinitions {
... on SelectFieldDefinition {
id
name
optionsValues {
value
id
}
}
... on MultipleSelectFieldDefinition {
id
name
optionsValues {
id
value
}
}
}
}
}

Variables

{
"eventId": "RXZlbnRfMQ=="
}

Create Custom Fields

This mutation can be used to create custom fields on the entities: People, Exhibitors, Planning (Sessions) and Products (Items).

Arguments

  • eventId - The Id of the Event on which the custom field needs to be created.

  • name - The name of the custom field.

  • target - The Entity on which the custom field needs to be created (PEOPLE, EXHIBITOR, SESSION or ITEM)

  • type - The data type for the custom field. The type can have the following values : DATE, LONG_TEXT, MEDIA, MULTIPLE_SELECT, MULTIPLE_TEXT, NUMBER, SELECT, TEXT, TREE, URL

  • For custom fields with values (select and multiselect format), they should be first created (except for People) by using Studio or Content API and their values must be set by using the mutation setSelectFieldValue.

Query

mutation createFieldDefinition($input: CreateFieldDefinitionV2Input!) {
createFieldDefinition(input: $input) {
Event {
id
}
}
}

Variables

{
"input" : {
"eventId" :"RXZlbnRfMQ==",
"name":"Where did you hear about this event?",
"translations": {
"language": "en_US",
"name": "Where did you hear about this event?",
"placeholder": "Select how do you discover the event"
},
"target":"PEOPLE",
"type":"SELECT",
"isEditable":true,
"isVisible":true
}
}

Update Custom Fields

This mutation can be used to update custom fields on the entities: People, Exhibitors, Planning (Sessions) and Products (Items).

Arguments

  • fieldDefinitionId - The Id of the custom field to be updated.

Query

mutation updateFieldDefinition($input: UpdateFieldDefinitionV2Input!) {
updateFieldDefinition(input: $input) {
event {
id
}
errors {
code
}
}
}

Variables

{
"input" : {
"fieldDefinitionId" : "RmllbGREZWZl0aW9uXzQwNDAxNg==",
"maxCharacters":200,
"isEditable":true,
"isVisible":true
}
}

Create Custom Fields value for Multiple or Single Select type Custom Fields

This mutation can be used to set option values for Single or Multiple select type custom fields.

Arguments

  • fieldDefinitionId- The custom field should already exist and the id needs to be sent in this parameter.
  • key - The key of the custom field value, this is the id attached to the custom field value. Once created, it can be found by hovering the mouse on the custom field value under the custom field settings in Studio.
  • translations - The value of the custom field in different languages and their translations need to be added in this parameter.

About Select and Multiselect custom fields values, when they are created directly in Studio, the key is populated according to the name provided and some additional logic:

  1. Lowercase
  2. Diacritics
  3. Slugify

E.g. When creating a value 'São Tomé and Príncipe', the key generated is 'sao-tome-and-principe'

In order to not create duplicates, if values are created from Studio and API, we recommend you to apply the same logic for keys when creating values from API.

Keys are then used to apply a value to a specific People, Exhibitor, Planning (session) or Product (item).

Query

mutation setSelectFieldValue($data: SetSelectFieldValueInput!) {
setSelectFieldValue(input: $data) {
selectField {
... on MultipleSelectField {
id
value
translations {
language
value
}
}
}
}
}

Variables

{
"data":
{
"fieldDefinitionId" : "RmllbGREZWZpbml0aW9uXEzNg==",
"key":"india",
"translations": [
{
"language": "en_US",
"value" : "INDIA"
},
{
"language": "fr_FR",
"value" : "INDE"
},
{
"language": "es_ES",
"value" : "INDIAS"
}
]
}
}

Delete Custom Field

This mutation can be used to delete custom fields on the entities: People, Exhibitors, Planning (Sessions) and Products (Items).

Arguments

  • eventId - The Id of the Event on which the custom field needs to be deleted.
  • fieldDefinitionIds - The Ids of the custom fields to be deleted. This is an array and can hold more than one value separated by commas.

Query

mutation deleteFieldDefinition($input: DeleteFieldDefinitionsInput!) {
deleteFieldDefinitions(input: $input)
{
errors {
code
}
event {
id
}
}
}

Variables

{
"input" : {
"eventId": "RXZlbnRfMQ==",
"fieldDefinitionIds":[
"RmllbGREZWZpbml0aW9uXzQwNDAxNg==",
"RmllbGREZWZpbml0aS3uXzQwNDAxNg=="
]
}
}

Delete a single or multiple choice values of a Custom Field

This mutation can be used to delete single or multiple choices values of a custom field.

Arguments

  • fieldDefinitionIds - The Ids of the custom fields to be deleted. This is an array and can hold more than one value separated by commas.

Query

mutation deleteSelectFieldValues($input: DeleteSelectFieldValuesInput!) {
deleteSelectFieldValues(input: $input) {
deletedSelectFieldsIds
}
}

Variables

{
"input" : {
"fieldDefinitionId" : "RmllbGREZWZpbml0aW9MzMg==",
"keys": "testeposters"
}
}