How to update a db array from coded component

I have a problem with updating a array after i have changed its values with javascript in coded component, and here is the code:
image
the to lines that are commented out is what i have tried, but this did not work. is there any other way for me to push the updated array to replace the table from appfarm.

Hi Naser,

No method is provided to update objects in data sources directly from the Coded Component. In order to do that you should connect an action, using action params to pass values if required. Read more about it here under Integrating with Actions.

If you wish to update the a value of an object in a datasource from your Coded Component, you should create an Action in Appfarm Create for updating an object in your data source (taking the id and new value as action parameters) and bind it into the Coded Component. (In Actions in the Settings of the Coded Component)

You may then interact with the Appfarm Action through your Coded Component updating the object with the specified id and setting the passed value.


function updateVariableInContent(variableId, newValue) {
    
    [...]
    
    appfarm.actions.updateMyObject({
        id: objectId,
        value: newValue
    });

}

Hope this helps!

1 Like