> ## Documentation Index
> Fetch the complete documentation index at: https://superofficeas-bugfix-ty-screen-designer-paradox.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Look up customers

> How to look up customers with CRMScript

## Bool findFromEmail(String email)

Looks up a customer in the primary database based on an email address.

```crmscript theme={null}
Customer c;
printLine(c.findFromEmail("jean-luc@superoffice.com").toString());
```

## Bool findExternallyFromEmail(String email)

Same as `findFromEmail()`, but looks in external data sources.

## Bool findExternallyFromEmail(String email, Integer extTable)

A variant of `findExternallyFromEmail()` that limits the look-up to 1 specific source.

## Bool findFromCellphone(String cellphone)

Looks up a customer in the primary database based on a cellphone number.

```crmscript theme={null}
Customer c;
printLine(c.findFromCellphone("12345678").toString());
```

## Integer findExternallyFromKey(Integer table, String key)

Looks up a customer in an external data source (`ext_table.id`) based on its primary key.

* If a match is found in the local proxy, the customer is loaded.
* Otherwise, if a match is found externally, a proxy is created and saved.

## Integer findFromAgentAndKey(Integer agent, String key)

Looks up a customer that is owned by the agent and matches the external key.

Returns the ID of the customer from the database, or -1 if not found.
