Search Contact by ViewBag
Contacts
Search Contact by ViewBag
Finds a contact whose ViewBag contains a specific key-value match
Painel de configuracao
Esta visualizacao usa o frontend real do ConfigPanel em modo embed, carregando um no de exemplo com o JSON base desta documentacao.
Preview real do painel
JSON base do node
{
"_nodeType": "contact.searchByViewBag",
"key": "",
"value": ""
}Portas
Entradas
Input
input · control
Saidas
Output
default · control
Error
error · error
Notas de uso
Output: local.<nodeId>.contact → same shape as contact.get: { id, phone, name, whatsAppId, viewBag: { ... }, createdAt, updatedAt }.
**Fields:**
- `key`: ViewBag key to search by (e.g., `"cpf"`, `"matricula"`, `"email"`). Required.
- `value`: Expected value (Handlebars). E.g., `{{input.text}}` to search by what the user just typed.
**Behavior:** Returns the FIRST contact whose `viewBag[key]` equals `value` (text comparison). Returns null (error port) if no match.
**Common patterns:**
- **Validate CPF:** contact.searchByViewBag(key="cpf", value="{{input.text}}") → condition(found?) → "CPF encontrado" / "CPF não cadastrado".
- **Lookup by ID:** contact.searchByViewBag(key="matricula", value="{{input.text}}") → use found contact data.
- **Cross-contact lookup:** Find a contact by any stored field, then operate on their data.
**Error port:** Fires when no contact matches the search criteria. Use for "not found" branches.
**Accessing found contact data:**
- `{{local.<nodeId>.contact.name}}` — contact name
- `{{local.<nodeId>.contact.phone}}` — contact phone
- `{{local.<nodeId>.contact.viewBag.KEY}}` — any ViewBag field of the found contact