Start a conversation

Setting Custom Fields for a User

Custom fields can be set on the User type using the appropriate form in the Aurora UI, or via either one of the create mutations or update mutations, which are listed in the sections below:

User Create Aurora UI

The User Registration Form will display any custom fields that have been configured to be createable via the UI:

To configure a field so that it will show up on the User Registration Form, the field must be configured in the following way:

  • The createable field must be set to either YES or REQUIRED.
  • The access > write field must be set to either PUBLIC or PRIVATE (if you only want the user to be able to set it, set to PRIVATE. If you want anyone to be able to set it, set to PUBLIC).
    • The standard configuration for user profile fields that anyone should be able to see is PUBLIC for read (anyone can see the field) and PRIVATE for write (only the user can change the field).
  • The valueDefinition > valueType field must be either BOOLEAN, DATETIME, FLOAT, INT, LONG, or STRING (LIST_FLOAT, LIST_INT, or LIST_STRING are not supported currently for setting via the UI).
  • The valueDefinition > createEntityFormField must be set to a valid form control.
  • The field name must be added to the customFieldNames field in the user.entity.json file.

User Create Mutations

The following Create Mutations support including custom fields.

registerUser

The registerUser mutation can be used to create a new user with custom fields.

fragment CustomFieldView on CustomField {
    name
    ... on CustomBooleanField {
       booleanValue
    }
    ... on CustomStringField {
        stringValue 
    }
    ... on CustomIntField {
        intValue 
    }
    ... on CustomLongField {
        longValue 
    }
    ... on CustomFloatField {
        floatValue 
    }
    ...on CustomDateTimeField {
        dateTimeValue
    }
    ... on CustomStringListField {
        stringListValue 
    }
    ... on CustomIntListField {
        intListValue 
    }
    ... on CustomFloatListField {
        floatListValue 
    }
}
 
mutation RegisterUser($registerInput: UserRegistrationInput!) {
  registerUser(registerInput: $registerInput) {
    result {
      id
      login
      email
      rememberPassword
      firstName
      lastName
      userAcceptsTermsOfService
      customFields {
           ...CustomFieldView
      }
      __typename
    }
    errors {
      ... on DuplicateLoginWithSuggestion {
        fields
        suggestedLogin
        __typename
      }
      ... on InvalidLoginValue {
        fields
        login
        __typename
      }
      ... on MinimumAgeRequiredError {
        fields
        minimumAge
        __typename
      }
      ... on LessThanMinValueError {
        fields
        min
        __typename
      }
      ... on GreaterThanMaxValueError {
        fields
        max
        __typename
      }
      ... on NotValidPossibleValueError {
        fields
        possibleValues
        __typename
      }
      ... on CustomFieldForEntityError {
          __typename
          fields
          customFieldName
          entityType
      }
      ... on Error {
        fields
        __typename
      }
      __typename
    }
    __typename
  }
}
{
    "registerInput": {
        "login": "cf_usercm511",
        "email": "cf_usercm511@test.com",
        "password": "arfarf",
        "userAcceptsTermsOfService": true,
        "rememberPassword": false,
        "customFields": [
            {
                "name": "v2testString",
                "value": "New testString value66"
            },
            {
                "name": "v2testInt",
                "value": "190"
            },
            {
                "name": "v2testIntList",
                "value": "1,2,3,4,5,6,7,866"
            },
            {
                "name": "v2testFloat",
                "value": "2.566"
            },
            {
                "name": "v2testFloatList",
                "value": "0.5,1.0,1.5,2.0,2.5,3.066"
            },
            {
                "name": "v2testLong",
                "value": "2695137"
            },
            {
                "name": "streamingService",
                "value": "Streaming Service new value"
            },
            {
                "name": "lastWatchDate",
                "value": null
            }
        ]
    }
}

registerInvitedUser

The registerInvitedUser mutation registers a new user with an invitation token.

fragment RegisterUserError on Error {
  __typename
  fields
  ... on DuplicateLoginWithSuggestion {
    suggestedLogin
  }
  ... on InvalidLoginValue {
    login
  }
  ... on MinimumAgeRequiredError {
    minimumAge
  }
  ... on LessThanMinValueError {
    min
  }
  ... on GreaterThanMaxValueError {
    max
  }
  ... on NotValidPossibleValueError {
    possibleValues
  }
}
 
mutation RegisterInvitedUser($registerInput: UserInviteRegistrationInput!) {
  registerInvitedUser(registerInput: $registerInput) {
    result {
      login
      email
      rememberPassword
      firstName
      lastName
      userAcceptsTermsOfService
    }
    errors {
      ...RegisterUserError
    }
  }
}
{
    "registerInput": {
        "login": "cf_usercm511",
        "email": "cf_usercm511@test.com",
        "password": "arfarf",
        "userAcceptsTermsOfService": true,
        "rememberPassword": false,
        "customFields": [
            {
                "name": "v2testString",
                "value": "New testString value66"
            },
            {
                "name": "v2testInt",
                "value": "190"
            },
            {
                "name": "v2testIntList",
                "value": "1,2,3,4,5,6,7,866"
            },
            {
                "name": "v2testFloat",
                "value": "2.566"
            },
            {
                "name": "v2testFloatList",
                "value": "0.5,1.0,1.5,2.0,2.5,3.066"
            },
            {
                "name": "v2testLong",
                "value": "2695137"
            },
            {
                "name": "streamingService",
                "value": "Streaming Service new value"
            },
            {
                "name": "lastWatchDate",
                "value": null
            }
        ]
    }
}

createUser

The createUser mutation creates a new user using custom fields.

fragment CustomFieldView on CustomField {
    name
    ... on CustomBooleanField {
       booleanValue
    }
    ... on CustomStringField {
        stringValue 
    }
    ... on CustomIntField {
        intValue 
    }
    ... on CustomLongField {
        longValue 
    }
    ... on CustomFloatField {
        floatValue 
    }
    ...on CustomDateTimeField {
        dateTimeValue
    }
    ... on CustomStringListField {
        stringListValue 
    }
    ... on CustomIntListField {
        intListValue 
    }
    ... on CustomFloatListField {
        floatListValue 
    }
}
 
mutation createUser($createInput: CreateUserInput!) {
    createUser(createInput: $createInput){
        result {
            login
            email
            ssoId
            firstName
            lastName
            biography
            customFields {
                ...CustomFieldView
            }
        }
        errors {
            ... on DuplicateLoginWithSuggestion {
                fields
                suggestedLogin
                __typename
            }
            ... on InvalidLoginValue {
                fields
                login
                __typename
            }
            ... on LessThanMinValueError {
                fields
                min
                __typename
            }
            ... on GreaterThanMaxValueError {
                fields
                max
                __typename
            }
            ... on NotValidPossibleValueError {
                fields
                possibleValues
                __typename
            }
            ... on CustomFieldForEntityError {
                __typename
                fields
                customFieldName
                entityType
            }
            ... on Error {
                fields
                __typename
            }
            __typename
        }
    }
}
{
    "createInput": {
        "login": "cf_usercm513",
        "email": "cf_usercm513@test.com",
        "password": "arfarf",
        "userAcceptsTermsOfService": true,
        "rememberPassword": false,
        "customFields": [
            {
                "name": "v2testString",
                "value": "New testString value66"
            },
            {
                "name": "v2testInt",
                "value": "190"
            },
            {
                "name": "v2testIntList",
                "value": "1,2,3,4,5,6,7,866"
            },
            {
                "name": "v2testFloat",
                "value": "2.566"
            },
            {
                "name": "v2testFloatList",
                "value": "0.5,1.0,1.5,2.0,2.5,3.066"
            },
            {
                "name": "v2testLong",
                "value": "2695137"
            },
            {
                "name": "streamingService",
                "value": "Streaming Service new value"
            },
            {
                "name": "lastWatchDate",
                "value": null
            }
        ]
    }
}

User Update Aurora UI

The My Settings Page will display any custom fields that have been configured to be createable via the UI at the bottom of the Personal Settings Form:

To configure a field so that it will show up on the Personal Settings Form, the field must be configured in the following way:

  • The updatable field must be set to either YES or REQUIRED.
  • The access > write field must be set to either PUBLIC or PRIVATE (if you only want the user to be able to set it, set to PRIVATE. If you want anyone to be able to set it, set to PUBLIC).
    • The standard configuration for user profile fields that anyone should be able to see is PUBLIC for read (anyone can see the field) and PRIVATE for write (only the user can change the field).
  • The valueDefinition > valueType field must be either BOOLEAN, DATETIME, FLOAT, INT, LONG, or STRING (LIST_FLOAT, LIST_INT, or LIST_STRING are not supported currently for setting via the UI).
  • The valueDefinition > updateEntityFormField must be set to a valid form control.
  • The field name must be added to the customFieldNames field in the user.entity.json file.

User Update Mutations

The following Update Mutations support including custom fields.

updateUser

Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. ATLAS

  2. Posted
  3. Updated

Comments