Introduction #
In this tutorial, we will learn how Agent File Adapter works for Producer. Agent File adapter for producer uses for writing a file from salesforce to file. Agent file adapter for Producer means outbound Agent File Adapter. To use the Agent File adapter for Producer, we need to configure the Agent Control Board, and we need to create an Agent File Adapter. In this chapter, we will learn how to use the Agent File adapter for the producer, and we will know how to do outbound with CSV, Excel file type.
Pre-required #
Firstly, you need to have some required step before you can use the Agent File adapter:
- Create Metadata Provider, Istructure Repository
- Create Integration and Configure a new agent control board
- Create Agent File Adapter (Outbound) on the new Agent Control Board
- Create an Outbound interface
- Checking Cache monitoring status
- Callout to new Agent
How to use Agent File Adapter for Producer?
Step-1: Create Message Type
- Create Metadata Provider
- Create a Repository
- Go to the Repository details page then click the New Message type button
- Fill all required fields then click the Save button
- Navigate to the Related tab and select Message type field Entry
- After that, we got the Message type
Step-2: Create Integration and test connection destination.
Create new Integration by following the guide https://docs.skyvva-dev.com/docs/tutorial-v2-41-lightning/what-is-an-integration-and-how-to-create-it/
- Navigate to AGENT Control Board as shown below:
- In the configuration tab enter the connection destination name, select the adapter type and click on the button “Continue”
- Fill in all the required detail
- Click the button Ping Agent Connection
- Fill in all the required details
- Click the button Ping Salesforce Connection
- Ping connection successfully
- Save the connection destination
Case 1: Create Outbound Agent File Adapter for CSV format and Protocol: Local.
Step-3: Create an outbound Agent File Adapter on the new Agent Control Board
- Navigate to the Adapter tab after that click the button New
- Fill all required fields
– Name: any Name
-Type: Agent File
-Direction: Outbound
-Status: Active
-Protocol: Local
-File Type: CSV
-Folder: location folder
-File Name: Account.csv
-Outbound File Threshold Size(MB): 5
-File Handling Mode: you can choose the mode
-Connection Destination: your destination name
Step-4: Create Outbound Interface
- For creating the Interface need to follow this guide https://docs.skyvva-dev.com/docs/tutorial-v2-41-lightning/what-is-an-interface-and-how-to-create-it/
- Create an outbound Interface for Asynchronous mode, operation(upsert), Choose Adapter, Metadata Provider, Repository, and Message Type
[su_box title=”Note” box_color=”#2a8af0″ title_color=”#000000″] Agent File Adapter support only Asynchronous Mode.[/su_box]
- Mapping:
Step-5: Check Cache monitoring status
- Integration:
- Interface:
- Mapping
- Adapter:
- Interface Group:
- Navigate to Developer Console, Open Execute Anonymous Windo, and then past the callout code. As show below:
[aux_code language=”javascript” theme=”tomorrow” title=”Callout” extra_classes=””]
skyvvasolutions.CallOutControl c = new skyvvasolutions.CallOutControl();
c.returnJSONComplete=true;
c.actionDoIntegrate=true;
c.isCreateMessage=true;
String[] ids= new String[]{‘0011j00000qwCoXAAU’,’0011j00000qhAC1AAM’};
List<skyvvasolutions.CalloutResponse> result =
skyvvasolutions.Iservices.invokeCalloutV3(‘Agent-File’,’Outbound’,ids,’AUTO’,c);
[/aux_code]
- As a result of message monitoring, those record has been sent out
- CSV File:
Case 2: Create Outbound Agent File Adapter for Excel format and Protocol: Local.
- Create an Outbound Agent File adapter
- Go to Agent control board -> Click Adapter -> Click New button. (We configuration like the case 1 but choose File Type Excel )
- Create an outbound Interface for Asynchronous mode, operation(upsert), Choose Adapter, Metadata Provider, Repository, and Message Type
- Outbound adapter
- Mapping:
- Callout:
- As a result of message monitoring, those record has been sent out
Excel file:
Case 3: Create Outbound Agent File Adapter for CSV format and Protocol: FTP.
- Create an Outbound Agent File adapter
- Fill all required field
-Name: any Name
-Type: Agent File
-Direction: Outbound
-Status: Active
-Protocol: FTP
-Host: Public IP Address
-Username: FTP Username
-Password: FTP password
-Port: FTP Server Port
-File Type: CSV
-Folder: location Folder
-File Name: Account.csv
-File Handling Mode: Append
-Outbound File Threshold Size (MB): 5
-Connection Destination: your destination name
- Create an Outbound Interface with Message Type.
- Outbound Adapter
- Mapping
- Callout:
- Message Monitor
CSV:
Case 4: Create Outbound Agent File Adapter for CSV format and Protocol: SFTP.
- Create an Outbound Agent File adapter
- Fill all required field
Name: any Name
-Type: Agent File
-Direction: Outbound
-Status: Active
-Protocol: SFTP
-Host: Public IP Address
-Username: SFTP Username
-Password: SFTP password
-Port: SFTP Server Port
-File Type: CSV
-Folder: C: File_Adapter
-File Name: Account.csv
-File Handling Mode: Append
-Outbound File Threshold Size (MB): 5
-Connection Destination: your destination name
- Create an Outbound Interface with Message Type.
- Outbound adapter
- Mapping
- CallOut:
- Message Monitor
CSV:
Summary:
Agent File adapter for Producer uses for writing data from salesforce to file. Finally, we have learned about how to do outbound data from salesforce to file. In Agent adapter for a producer can work with CSV, and Excel data records.