How to use Update Record with the Firebase Connector

I have managed to use the Firebase Connector to create and read a Firestore document but I haven’t managed to update this record.

Here is my Firestore favorites document which consists of id, userID and an array of favorite artworks IDs (userFavorites)

I configured favorites in the data section and added a binded data variable (favorites1)

I have successfully read the relevant Firestore document using “Get Record Collection” specifying userID in the filter. The result is put in the favorites1 data variable.

At some point a user might add or remove a favorite item and I get this to be reflected successfully in the userFavorites array.

How do I configure “Update Record” in order to update the relevant Firestore document?

image

More specifically, what exactly needs to go into “Identifier” and “Record”?

image

image

What I have right now returns a “ReferenceError: Buffer is not defined” error!

Here is the favorites1 data variable properties from the Debugger at the time I attempt to execute “Update Record”

Is this bug report related?

Is it possible that Creating or Updating any array in a Firestore document using the Firebase Connector returns an error while Reading arrays from previously created Firestore documents works fine?

@Mevi @Mari

Is it possible for an admin to confirm that currently it is not possible to create or update arrays in a Firestore document using the Firebase Connector?

Many thanks!

Hi John,

I couldn’t get it to work (update an array in firebase), no matter how hard I tried. I had to model the data in another way.
There’s another post with a long discussion. At the end, it’s concluded that for the moment (the moment of the post) it isn’t possible to update array. Maybe there’s a way to get it to work now.

P.S. If you find a solution, please post back here, as it will be useful to many users.

1 Like

@Alan_Alves

Thanks for your reply!

I guess I’ll to re-model the data as you suggested.

1 Like

Issue solved. If you use the SAP AppGyver Preview app instead of the original AppGyver Preview app creating and updating Firestore documents that also contain arrays works as expected. Apparently a fix for this issue was included in a release from October 6, 2021.

SAP AppGyver Preview / Runtime version 3.0.5 / Paser version 5.0.4
(original) AppGyver Preview / Runtime version 2.12.2 / Paser version 4.0.4

This of course raises the question why AppGyver haven’t removed the legacy app from the Google Play store or at least put out a final version containing a splash screen upon entry warning developers that this version doesn’t contain all the latest features and bug fixes. Doing so could saved some of us hours of frustration trying to solve issues that have already been fixed.

In any case, thanks AppGyver for fixing this issue!

1 Like

Does the Update Record flow component work for a firestore data resource? Looks like it uses PUT where Firebase needs PATCH. Please help.

Hi Kaushik,

I think I had the same issue you are sitting with.

Are you battling to get the specific firestore document I’d when you need to update the record.

My mistake was that I had another Field id causing a confusion when getting the id from firestore.

Once this was deleted I only made sure I didn’t write an Id to the firestore database from AppGyver.

Once this was done when I did the repeat list the document Id was showing in a row allowing me to add the document I’d to a variable.

Once it is a variable I use update to update the specific field on the document by using the variable referring to the document Id.

Please let me know if this helps you?

Tx a ton Ashley. I figured out the problem. It works now.