Skip to content

Get document property 'Has field' variable not valid #1144

@Mattmannn

Description

@Mattmannn

Has your issue been reported?

  • I have searched the existing issues and confirm it has not been reported.
  • I give permission for members of the FlutterFlow team to access and test my project for the sole purpose of investigating this issue.

Current Behavior

TLDR: Set Variable throws 'Current variable is not valid' when trying to check for Has Field in a document custom data type (map).

Expected Behavior

The Set Variable should accept my Has Field check in Get Document Property

Steps to Reproduce

  1. Create a Firestore project
  2. Connect it to the new project
  3. Add Firestore project name in FF
  4. Generate config files
  5. In Firestore, create a 'jobs' collection
  6. Create a document e.g. 'job_id' in
  7. Add a 'status' map field
  8. Add 'status1' array
  9. In FlutterFlow, create a custom 'statusMap' data type
  10. Add 'status1' field data type String (List)
  11. Create new FlutterFlow page
  12. Add a container
  13. Add backend query to get the job_id document (query collection, doc from reference)
  14. Add text
  15. Set text from variable
  16. Conditional value
  17. If jobs Document -> status -> Has Field -> status1
  18. Confirm

Reproducible from Blank

  • The steps to reproduce above start from a blank project.

Bug Report Code (Required)

IT4oivLqy4Z1ru5E7a6Jd+9VnSQ7KUR7apEv0cpOEC0jF7KuBqQiZPTBT1VvOdfiaVNcAk2YkXwf097zhvHPCMIDAwubfos/yJB+cgn0e2itVrKuC5e0SnB6QO1QIXK51rWJ3Ap5CLRZc0Ym3TmQAeiRExHDFOu/Zwh9f6PHaOI=

Context

I have a Firestore collection with the following data structure:

jobs (collection)
     [doc]
          other_fields (misc. types)
          status (map/custom data type in FF)
               other_statuses (array/string(List))
               new_created (array/string(List))
                    [0] specialist1_id (string)
                    [1] specialist2_id (string)

I want to display a conditional text based on whether 'new_created' contains any fields (i.e. any specialists seeing the job as 'new'). I added a backend query to get a job document from reference, and then I added conditional values to my text:
IF 'jobs' Document 'status' (map) Data Structure Field 'new_created' List Contains Item - true
this worked fine, but I realized I wanted to check for errors first, so I tried to add
IF 'jobs' Document 'status' (map) Has Field 'new_created'
to check whether this new_created status field exists at all first, before checking its contents. However, I got 'Current variable is not valid'.

Visual documentation

image
image
image
This is the first condition, which works fine, but then when trying to accomplish the following, it throws an error:
image
This is my 'jobs' collection schema:
image
This is my 'mapStatus' custom data type:
image

Additional Info

No response

Environment

- FlutterFlow version: 3.1
- Platform: Chrome Flutterflow desktop app/extension
- Browser name and version: Chrome 114.0.5735.199
- Operating system and version affected: Windows 11 22H2

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions