Retool Portal - Customer Comments not Working

I built an app which we shared with a customer via Retool Portals. Currently they just have "Use" access. The app is essentially just a table of data (think Google Sheets). However, I wanted to give our customer the ability to submit comments in the table so I created a Comment column. I am able to add comments as I have edit permissions, but my customers are complaining because they can't add comments.

I don't want to give them unrestricted "Edit" access to the app and feel like there should be some in between setting. Am I missing something?

Hey @David_Patterson-Cole - This will depend a lot on how you have your app set up. What resource are you using for the data and are you using shared credentials or is each user authenticating themselves? Can you also share some details on your table set-up, have you made just that one column editable and are changes triggering a write-back to the initial resource? Any more details you can provide about what your client sees would be really helpful here so I can further assist. Thanks!

Thanks for the reply Lauren. If there is some way I can DM you, I can share a Loom video demonstrating the bug (just can't share customer data on the forum).

I've since discovered that it's not even just the customer. When I personally try to save text in this "comments field" it doesn't work. It let's me type text into the field, but when the save button pops up and I click it, it never goes away. The save button just stays there almost like the click wasn't processed (no matter how many times I click save). Then if I leave the page or refresh, the data I type in will be erased.

My data source was Google Sheets for the other columns of the table. I kind of assumed this column would just be separate from the data source (I don't need it to write back), but maybe I was wrong about that.

Hey @David_Patterson-Cole Thanks for that additional detail. It sounds like you'll just need to add a save handler to the table such that when any comment is added to that column you are able to retrieve this back. This would then need another resource query which specifically writes data.

Again here - depending on whether the users are utilising shared credentials or not will impact what they are able to do. If you are utilising shared credentials, as long as the query only updates the one column, this is the only data that they'll be able to edit within the app.

Screenshot 2023-10-26 at 11.01.52

Let me know how you progress here and if this helps set you on the right path! Any further issues, just shoot me a reply with any details about your setup and we can take a closer look.

Thanks Lauren! So I have the save handler and the resource query that writes to my google sheet but I'm having trouble passing data between the two. Do I need a second event handler that saves the comment value in a variable so I can access it in my resource query? Or is there a way to pass variables along as part of my control query?

I uploaded a photo of my save handler and resource query:


Hey @David_Patterson-Cole - thanks for clarifying- you'll only need one event handler for either the save action (manual save) or change cell. Sorry I didn't realise you were using that already. Using the save actions is nice as you can bulk update changes but you can also do this just on a cell-by-cell basis.

You can use the table's changesetArray property to push only the changes directly to Google Sheets. On top of that, you'll want to make sure you have a success handler within that query to pull you spreadsheet data again so that you can see the updates reflected in your Retool app. Finally, you'll then also want to clear out your changesetArray values (this is a built-in option with the save handler) which can be done using the clearChangeset() method. This will ensure that after those updates have gone through, future changes are registered correctly.

Please let me know if you need clarification on any of the above or if you run into any further issues!

I'm fine with just manual save. So I guess I just need the "add-on save handler" that triggers my resource query (image below). I'll delete the "Change cell" event handler.

image

But I still have the question of how I pass variables to the resource query. I need the variables you can see in my previous image (titled "Save Resource Query"). Is that not done via the add-on save handler (which triggers the resource query) but instead via the changesetArray you mentioned?

Hey @David_Patterson-Cole - that's right! You'll use the changesetArray in the query itself and the changeset will reflect only what's been changed before the save! I would recommend using the bulk update option in case multiple rows are changed. It would look something like this:

Hope this helps!

Thanks! The save runs now (i.e. I don't receive an error message and the save pop up dissapears along with the success message), but it doesn't actually write to my Google Sheet and when I refresh Retool the content is gone (presumably because it looks at the Google Sheet and doesn't find the comment).

Here is my setup

@David_Patterson-Colelooks like you have the comment as the primary key but this is something that you're trying to edit. Do you have a column with an ID or a consistent value that aligns with the primary key in the rest of your table?

Oh I see what you mean. That fixed it - thank you for all your help!!

1 Like