---
title: Xero Contact Flow
slug: xero/xero-contact-flow
description: Learn how to leverage Salesforce automation practices to effortlessly generate Xero Contact records using Breadwinner Apex Generator. This document outlines the step-by-step process of creating a custom field, generating an Apex class, and automating Xero
docTags: 
createdAt: 2023-02-15T08:58:01.000Z
---

This is an example of the Invocable Method generated by Breadwinner Apex Generator, which a standard Flow can invoke. This is useful as it shows how you can use Salesforce standard automation practices to drive Xero Contact record creation. Using this format, you can extend to Update or Read similarly.

This primary use case shows how easy it is to create robust automation in Salesforce to facilitate **Xero Contact** record creation in **Breadwinner for Xero Application**. Extending upon this, using the Global API requests in this help site, you can perform many automated retrieves, create, or update functions directly rather than requiring extensive middleware or endpoint processing to perform.&#x20;

### Create Custom Field

**Step 1**: Create a “**Send to Xero**” custom field of Checkbox Data Type on the Account object.

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/HPyg6LDXtcvZUWf72GKGj_12.png "Custom field Creation")

### Apex Class Generation

**Navigate to Breadwinner Setup > Tools > Apex Generator**

**Step 2**: Choose the record mode **Create&#x20;**&#x6F;n a **Xero Contact** using a Flow.
**Step 3**: Select the option for Run this Flow (I will check "Run Asynchronously").

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/lug_z8VO5cs57lL4DRvr6_1apex-generator.png)

**Step 4**: Click on Next. It will navigate to the **Fields&#x20;**&#x73;election page. Click on **Generate Apex**.

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/tryooS4OhGJxQnGovUDoZ_2-generate-apex.png)

**Step 5**: Copy the generated Apex Class / Apex Test(optional) Class. Save/Deploy the copied code to the respective org.

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/gvrL2o0oi5bvmIxOLuYzk_3apex-class.png)

### Xero Contact Automation using Flow

**Step 1**: Navigate to Salesforce Setup > Flows > New Flow > Record-Triggered Flow

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/bf9LJwof1RDDr6C8-kVxY_4-record-triggered-flow.png "Record Triggered Flow")

**Step 2**: Choose the **options&#x20;**&#x73;imilar to those mentioned below, and click on **Done**.
&#x20;   1\. Select the Object (Account)
&#x20;   2\. Trigger Event (the record is created or updated)
&#x20;   3\. Entry Conditions (like “Send to Xero” is True)
&#x20;   4\. Check "Only when the record is updated to meet the condition requirements"
&#x20;   5\. Optimize Flow for (Actions and Related Records)
&#x20;   6\. Check the Run Asynchronously path (Only when the option "I will check "Run Asynchronously" (on Record-Triggered flow creation Page)" on Step 3)

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/JQCXbNekPdg8lTQajyK72_5-configure-start.png)

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/YnFd7KLWbOqcaPfkBN4Bn_7-configure-part.png)

**Step 3**: Create an Apex Action using the "Create Xero Contact" Invocable method.

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/HiXCelet6TMgYhjDK6_M1_8-apex-action.png)

**Step 4**: Map the Fields to Create **Xero Contact** in "Apex Action".

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/gJoEGsLIVOupCLc62qBTy_9-mapping.png)

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/yoYNnKDb-DR-qKQF43wJY_10.png)



![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/Znz95QxPxA2rOgsTtkYSE_11.png "Fields Mapping")

**Step 5**: Connect the Flow Steps, Click Save, and Activate.

-  Connect Record Trigger Flow Section to Apex Action (Run Asynchronously)

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/u5GqXxNXclKpSczNUf3l5_13.png)

### Triggering Xero Contact Creation

When you check the “**Send to Xero**” checkbox field in Account, it will create a Xero contact record with all the mapped fields in Salesforce and Xero.

**Step 1**: Select an Account/Create New Account.



![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/6m2fBC71jDsyI2XGrWWsR_14.png)

**Step 2**: Edit the Account to meet Trigger Criteria (Check the “Send to Xero” field) and give the other mapped field details.

**Step 3**: Evaluate the created Xero contact.

![](https://api.archbee.com/api/optimize/amOMwpmEgToJSqhaSTxXr/Pja3Piv2XQ1mAlPQ17ZdK_15.png "Xero Contact creation")

