Dynamically Refresh Data

From what I understand of the update behavior in Plugin, is that when any change happen in data (of field setting), the update function should run. So if data is added, modified or deleted, this should run the update part again.
But it doesn’t seem to work. Do I need to do something for that in the script?


My understanding is that it runs whenever a property in the property editor changes - not data in the DB if that’s what you mean. (Unfortunately, the use of the term “field” in the function’s documentation is inconsistent and confusing in that context.)

1 Like

Yes I agree. So except to create a workflow to force a refresh, there’s no way to have a plugin automatically update if a DB event happen (like native bubble thing)?

I don’t think so, but perhaps someone else will chime in with a definitive answer.

1 Like

I know this is an old post but I am trying to post answers to posts I have searched for when trying to figure stuff out. So if the bulk of your code for updating your plugin element is in the update function and you want that code to run after an Element Action -Triggered In Workflows then you can add event listeners in your update function and then change the value of a variable in function provided for your workflow action. Here is the example I used from stack overflow and I am sure I will be using this alot more. If anyone knows an easier way to trigger the update function then please let me know. https://stackoverflow.com/questions/1759987/listening-for-variable-changes-in-javascript

You can add an event listener but that’s not exactly the same as triggering the entire update function automatically.

Anytime one of your element data input fields is updated via associated/linked front end or backend changes , the update function runs from the start.

1 Like