Contentful logo

Contentful Community

Assign UI Extension to field programatically

Hi community,

I’d like to assign a UI Extension to an attribute programatically as part of my content migration scripts. I donot want to do this manually everytime I spin up a new environment or space.

Does the migration API support this?

Combining another topic - “How do you programatically assign users to a role”? I donot want to do this manually either !

Cheers,
Bliss

I am not sure about users but you can assign UI extension to a field.

    const aContentType = migration.editContentType('contentType');
    aContentType.changeFieldControl('<FIELD_ID>', '<EXTENSION_ID>', 'extension', {
       extensionParam1: Param1Value
       extensionParam2: Param2Value
    });
1 Like

For the user/role part, please refer to our Content Management API endpoint: https://www.contentful.com/developers/docs/references/content-management-api/#/reference/space-memberships/space-membership/update-a-single-space-membership/console/curl

1 Like