# Match Lead to Account

Takes a list of Leads from earlier in the Flow, finds matching Accounts and provides a list of [LeadToAccountMatch](https://docs.gradient.works/kb/automation-builder-kit-abk/models/leadtoaccountmatch) results for use later in the Flow. The matches can be used for assignment or [lead conversion](https://docs.gradient.works/kb/automation-builder-kit-abk/actions/leads/convertleadaction).

For more information on how to use this action, see [Lead and Account Matching](https://docs.gradient.works/kb/routing/matching).

## Configuration

{% tabs %}
{% tab title="Flow Element" %}

<figure><img src="https://2378295204-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUYXbv7c6RsZzQ00WCDTM%2Fuploads%2Fgit-blob-0f00ad61751bc2d8d3821edaf71f7e81bca433cc%2FMatchLeadToAccountAction.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Apex Properties" %}
Please note that you will not directly interact with these input fields as you do with some Flow Actions. Instead the Gradient Works custom editor takes care of the heavy lifting.

| Name                 | Required | Type        | Description                                                                  |
| -------------------- | -------- | ----------- | ---------------------------------------------------------------------------- |
| accountDomainField   | No       | String      | Deprecated                                                                   |
| accountNameField     | No       | String      | Deprecated                                                                   |
| filterData           | No       | String      | Include matches that meet all the specified filters                          |
| lead                 | No       | Lead        | The Lead to match to Accounts. Must fill out lead or leads.                  |
| leadCompanyNameField | No       | String      | Deprecated                                                                   |
| leadDomainField      | No       | String      | Deprecated                                                                   |
| leads                | No       | List\<Lead> | The list of Leads to match to Accounts. Must fill out lead or leads.         |
| matchCriteriaData    | No       | String      | Criteria for finding potential matching Accounts                             |
| rankerData           | No       | String      | If there are multiple matches, rank them according to the specified criteria |
| {% endtab %}         |          |             |                                                                              |
| {% endtabs %}        |          |             |                                                                              |

## Outputs

For easy access later in the flow, we recommend you select "Manually assign variables" in the Flow editor and store the `results` value in a variable.

| Name    | Type                                                                                                            | Description                                                                                                      |
| ------- | --------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------- |
| count   | Integer                                                                                                         | The number of results                                                                                            |
| result  | [LeadToAccountMatch](https://docs.gradient.works/kb/automation-builder-kit-abk/models/leadtoaccountmatch)       | The first result of matching Leads to Accounts. Can be used when working with a single Lead in place of results. |
| results | List<[LeadToAccountMatch](https://docs.gradient.works/kb/automation-builder-kit-abk/models/leadtoaccountmatch)> | The results of matching Leads to Accounts                                                                        |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.gradient.works/kb/automation-builder-kit-abk/actions/matching/matchleadtoaccountaction.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
