Can I change component properties within workflows?

How can I change a custom property of a custom component within a workflow? Do I have to write custom JS for that?

Thanks in advance,
Andy

Okay I tried it with a custom JS script when I click on an element inside the component. But it doesn’t work. Nothing happens… :pensive:

let prop = context.component?.props?.['715fbbfe-3879-4597-b24b-48bab3702a1c'];

prop = false;

Can you give more context on what you are trying to accomplish? :slight_smile:
Have you tried going using variables to manipulate your data instead?

Hey @jptrinh

In short:
I have created a component with a property “Done” (see screenshot) and I just want to know how to assign a new value to this property inside the component with a workflow.

In long:
I have bind the “Done” property inside of the component to a variable of the component to do the following:

  1. When I click an element in the component, I change the variable, which then changes the state of the component.
  2. When I change the property “Done” of the instance from outside the component, I wait in the component with the “On Property Change” event and then change the variable, which then changes the state. All good so far.

But how can I now ensure that when I execute point 1, it also simultaneously change the property “Done” so that the variable of the instance is always equal to the property of the component?

Or how is the common way to manipulate the same variable/property from inside and outside of a component instance? Could be that I have a thinking error in my approach here…

Thanks in advance :pray:

Property should not be change by the component, as they are own by the parent/exterior of the component.
To implement your pattern (two ways binding) you should emit a trigger (you can call it onChange for exemple) and update your variable using a workflow on your instance.
You can also expose a workflow to modify an internal variable from outside.

Other option
If you wish each instance to always have this value, you can define an internal variable and expose it, and have only an initial value property.

Hi @aurelie, thank you for your answer. And when I expose an internal variable, how can I bind it from outside with data from a database for example? Because it doesn’t appears in the right hand panel, like a property…