Skip to main content
Question

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

  • January 28, 2023
  • 4 replies
  • 2101 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?

4 replies

tank666
  • 4854 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
  • 4854 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!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings