API Query error entity.error/schema-field-not-found

Here’s my space & database:

What’s wrong with the following query?

[{ "command": "fibery.entity/query", 
  "args": { "query": {
  "q/from": "CRM/Person Email Activity",
  "q/select": ["fibery/id","fibery/public-id", "CRM/UUID"],
  "q/where": ["=", ["CRM/UUID"], "9b1f3c2e-6a44-4d3f-b1e7-2c9a5f0b8d6c"],
  "q/limit": 1
} } }]

I get this error:

name
entity.error/schema-field-not-found
message
"9b1f3c2e-6a44-4d3f-b1e7-2c9a5f0b8d6c" field was not found in "CRM/Person Email Activity" database.

If I remove the following line, query executes just fine:

  "q/where": ["=", ["CRM/UUID"], "9b1f3c2e-6a44-4d3f-b1e7-2c9a5f0b8d6c"],

Here’s the proof:

What am I doing wrong here?

I think you need to make use of “params” rather than including the search query value as a string literal

See the guide:

1 Like

You’re right. I’ve overlooked that.

[{ "command": "fibery.entity/query", 
  "args": { 
    "query": {
      "q/from": "CRM/Person Email Activity",
      "q/select": ["fibery/id","fibery/public-id", "CRM/UUID"],
      "q/where": ["=", ["CRM/UUID"], "$message_id"],
      "q/limit": 1
    },
    "params":{
      "$message_id": "9b1f3c2e-6a44-4d3f-b1e7-2c9a5f0b8d6c"
    }
  } 
}]

This one works just fine. Thanks again Chris!