Skip to main content
Question

How to change the content of a text property of an instance

  • January 28, 2023
  • 4 replies
  • 2247 views

a.nevolina

I’m a novice in plugin development, so the question is very basic: if a component has a property (type=“TEXT”), how can I change its value for the selected instance?

This topic has been closed for replies.

4 replies

tank666
  • 4873 replies
  • January 28, 2023

You need to use the setProperties(obj) method.

InstanceNode.setProperties({'propertyName': 'propertyValue'});

a.nevolina
  • Author
  • 2 replies
  • January 29, 2023

[quote="tank666, post:2Thank you for answering. I tried that but there is a strange error: “Could not find a component property with name: ‘Text’”. However, there is such a property in this instance


tank666
  • 4873 replies
  • January 29, 2023

propertyName corresponds to the names returned by componentPropertyDefinitions and should be suffixed with ‘#’ and a unique ID for ‘TEXT’, ‘BOOLEAN’, and ‘INSTANCE_SWAP’ properties.
InstanceNode | Plugin API


a.nevolina
  • Author
  • 2 replies
  • January 29, 2023

That worked, great!
I found the property: console.log(element.componentPropertyDefinitions); and indicated the property name. Thank you very much!