Xero Contact Flow
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.
Step 1: Create a “Send to Xero” custom field of Checkbox Data Type on the Account object.
![Custom field Creation Custom field Creation](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/HPyg6LDXtcvZUWf72GKGj_12.png?format=webp)
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 Document image](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/lug_z8VO5cs57lL4DRvr6_1apex-generator.png?format=webp)
Step 4: Click on Next. It will navigate to the Fields selection page. Click on Generate Apex.
![Document image Document image](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/tryooS4OhGJxQnGovUDoZ_2-generate-apex.png?format=webp)
Step 5: Copy the generated Apex Class / Apex Test(optional) Class. Save/Deploy the copied code to the respective org.
![Document image Document image](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/gvrL2o0oi5bvmIxOLuYzk_3apex-class.png?format=webp)
Step 1: Navigate to Salesforce Setup > Flows > New Flow > Record-Triggered Flow
![Record Triggered Flow Record Triggered Flow](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/bf9LJwof1RDDr6C8-kVxY_4-record-triggered-flow.png?format=webp)
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](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/JQCXbNekPdg8lTQajyK72_5-configure-start.png?format=webp)
![Document image Document image](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/YnFd7KLWbOqcaPfkBN4Bn_7-configure-part.png?format=webp)
Step 3: Create an Apex Action using the "Create Xero Contact" Invocable method.
![Document image Document image](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/HiXCelet6TMgYhjDK6_M1_8-apex-action.png?format=webp)
Step 4: Map the Fields to Create Xero Contact in "Apex Action".
![Document image Document image](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/gJoEGsLIVOupCLc62qBTy_9-mapping.png?format=webp)
![Document image Document image](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/yoYNnKDb-DR-qKQF43wJY_10.png?format=webp)
![Fields Mapping Fields Mapping](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/Znz95QxPxA2rOgsTtkYSE_11.png?format=webp)
Step 5: Connect the Flow Steps, Click Save, and Activate.
- Connect Record Trigger Flow Section to Apex Action (Run Asynchronously)
![Document image Document image](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/u5GqXxNXclKpSczNUf3l5_13.png?format=webp)
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 Document image](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/6m2fBC71jDsyI2XGrWWsR_14.png?format=webp)
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](https://images.archbee.com/amOMwpmEgToJSqhaSTxXr/Pja3Piv2XQ1mAlPQ17ZdK_15.png?format=webp)
![Doc contributor](https://s3.amazonaws.com/archbee-animals/cat.png)
![Doc contributor](https://s3.amazonaws.com/archbee-animals/gorilla.png)