---
title: "Configuring a Flow for Outbound Sync"
canonical: "https://help.fieldbuddy.com/space/FBDOCS/5738856450/Configuring%20a%20Flow%20for%20Outbound%20Sync"
format: markdown
---
It is possible to perform a sync from flow  
For that you will need following apex class to be created and deployed.

#### Example Invocable Class

```java
public class FlexConnectOutboundInvocable {
    @InvocableMethod(label='Sync to Exact Online' description='Outbound Sync')
    public static List<String> syncRecords(List<Id> recordIds) {
        List<String> response = new List<String>();
        FBCONNECT.cls_FBGlobalOutboundService service = new FBCONNECT.cls_FBGlobalOutboundService();
        service.runOutboundSync(new Set<Id>(recordIds),'Upsert');
        for(Integer i = 0; i < recordIds.size(); i++) {
            response.add('OK');
        }
        return response;
    }
}
```

Then it can be used in flow to pass a Record Id to perform an outbound sync

It will only do an Upsert operation


Class below can be used as an inspiration for unit test

```java
@IsTest
private class FlexConnectOutboundInvocableTest {

    @IsTest
    static void testSyncRecords() {
        List<Id> recordIds = new List<Id>{
            '001000000000001AAA',
            '001000000000002AAA'
        };

        Test.startTest();
        List<String> results = FlexConnectOutboundInvocable.syncRecords(recordIds);
        Test.stopTest();

        System.assertEquals(2, results.size(), 'Should return 2 results');
        for (String r : results) {
            System.assertEquals('OK', r, 'Each result should be OK');
        }
    }

    @IsTest
    static void testEmptyInput() {
        List<Id> recordIds = new List<Id>();

        Test.startTest();
        List<String> results = FlexConnectOutboundInvocable.syncRecords(recordIds);
        Test.stopTest();

        System.assertEquals(0, results.size(), 'Should return empty list for no input');
    }
}
```