Additional Scope issue on query

Hi everyone!

I am trying to make use of the editable text fields by creating an update query that gets triggered whenever the user edits a text field.

For that I've found "additional scope" and it looks like its a perfect match for my idea:
I have the ID for the textfield named like e_firstname (e for editable), once it changes a event gets triggered that runs a script and that script starts the query and sends the information of the textfield to the query as well.

image

On the query I use the self.id (slice off the first 2 letters) as key for the column and self.value as value received by the additional scope. But still, I get the issue that it doesn't have a value for the column. The additional scope gets send, so that shouldn't be the issue.

I think it might be related to the fact that the value of self.id is received as a string and like that the query doesn't work, but I am not sure.

So instead of

SET firstname = "Cesar"

it's received as

SET "firstname" = "Cesar"

Does someone have an idea on how to get further informations on that?

This is due to the query using prepared statements to prevent SQL Injection attacks - it's a good thing and although can be disabled org wide you should do so with extreme caution.

A safer workaround may be to use the "update record" GUI to pass in a record object and let Retool handle the hard work for you

1 Like

That worked. I am still new to Retool, so I had no clue that the GUI even exists :smile: But after a quick Google search I've found out what this is and I could immediately understand why you think its the better solution!

Works flawless now. Thank you.