Contentful logo

Contentful Community

Createfield() with default value

Hi! I’m making some migration scripts and I really need to set a default value for each field I’m creating I haven’t been able to find info of how to do it, this is what I got:

userAccess.createField(‘setPassword_title’, {
name: ‘Title’,
type: ‘Symbol’,
localized: true,
required: true,
validations: [],
disabled: false,
omitted: false

But I need something like value: ‘Default value’ do you have any ideas of how to do this ?

Hi there,
unfortunately it’s not possible to set default value when creating a new field in the migration CLI.
In order to set default value to a field, you will need to look into the Content Management API (CMA):