Update a document

This action allows you to edit/update document in a Firestore collection.

You still don't need to have the collection or "table schema" pre-determined. You can create any fields you'd like during document updates.


Inputs and Settings

Document ID

The ID of the document you want to update.

Collection

The name or ID of the collection the document you want to update is stored in.

Trigger ID (optional)

This will link the action with a Action Listener of the same ID.

If left blank, all listeners on the page with blank ID's will be triggered at the same time, so we suggest to always define a Trigger ID.

When the function finishes running, it will trigger the Document Updated event, storing the Updated Document ID on the listener's state.

Fields

The same way as on the Create New Document action you must inform which fields you want to update, in JSON format. This input allows you to set as many fields as you want.

For each field you must specify the "key" and the "value" that will be stored on it. For instance, you might want to invert the value of the "done" field in a task on our task manager sample app, when the check icon is clicked. You'd need to define the "key" = "done" and the "value" = "true" or "false".

The "done" field is set to the opposite of the current tasks "done" value. If "true", it'll be updated to "false", and vice versa

Field Types

For each key/value pair you define and provide a value on the Fields list, you must provide the same key, but with the type of the value, on the Field Types input. That allows the plugin to turn the texts being fed into the plugin into corresponding values on the JSON structure sent to Firestore.

If the number of Fields and Field Types don't match, the action will result in an error.

See the field types table to see which types are currently supported by the plugin and how to define them.


Triggered events

Those events are triggered by an Action Listener with the same ID as the Trigger ID provided on the action.

  • Document Updated (if the action was successful)

  • Error in Action (if an error occurs)


Stored values on the listener

Updated Document ID

The ID of the document updated by the action.

Error Message

If an error occurs, you can check its details on this state on the action listener.

Last updated