Global API
Code Examples

Xero Contact Flow

7min

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.

Create Custom Field

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

Custom field Creation
Custom field Creation


Apex Class Generation

Navigate to Breadwinner Setup > Tools > Apex Generator

Step 2: Choose the record mode Create on a Xero Contact using a Flow. Step 3: Select the option for Run this Flow (I will check "Run Asynchronously").



Document image


Step 4: Click on Next. It will navigate to the Fields selection page. Click on Generate Apex.

Document image


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



Document image


Xero Contact Automation using Flow

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

Record Triggered Flow
Record Triggered Flow


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



Document image




Document image


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

Document image


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

Document image

Document image




Fields Mapping
Fields Mapping


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

  • Connect Record Trigger Flow Section to Apex Action (Run Asynchronously)
Document image


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.

Document image


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.



Xero Contact creation
Xero Contact creation




Updated 09 Mar 2023
Doc contributor
Doc contributor
Did this page help you?