I am trying to install a addon to a field with migration scripts and content management api. I am not sure if the problem comes from the plugin itself or that i am doing something wrong.
I am using this plugin: Conditional Disabled Fields - Plugins — DatoCMS
The problem is with the targetFieldsApiKey. It does not seem to apply correctly as it doesn’t work as intended and in the admin panel its not set. It does however go to the right field.
Here is the code in question.
module.exports = async (client) => {
const plugin = await client.plugins.create({
packageName: 'datocms-plugin-conditional-disabled-field',
});
const apiKey = 'wide_cta::headline';
const headline = await client.field.find(apiKey);
const newAppearance = headline.appearance;
newAppearance.addons.push({
id: plugin.id,
parameters: {
targetFieldsApiKey: ['headline_image'],
},
field_extension: plugin.name,
});
await client.field.update(apiKey, {
appearance: newAppearance,
});
};
Also if i set up it manually and check what the object should look like it returns this. I think this i identical to the setup im doing in the migration script.
appearance: {
addons: [
{
id: '108777',
parameters: {
targetFieldsApiKey: ['headline_image'],
},
field_extension: 'conditionalDisabledFields',
},
],
},