Introduction #
From now the User is easier to synchronize their data to Google Drive from our new SKYVVA connector. Google connector, allowed Users to back up their data from Salesforce to Google Drive directly. That before they are spent time to back up their data by copying and paste the file to Google Drive. Within the new connector, they can back up their data automatically or do it manually from the Control Board. The user can transform their data to any file format such as CSV, XML, or JSON.
Pre-required
– Generate MessageType
– Create Google Adapter for outbound direction
– Create Outbound Interface and do mapping
– Manual process on Google Control Board
- Generate Message Type
We need to define the structure of the file before generating it from Salesforce. In our v3, the User needs to use the MessageType to define their structure. If they want to generate the field name same as sObject then they just create MessageType type as Salesforce Object.
In the example below, we used the structure from CSV File to generate the MessageType. We can also generate from the XML or JSON file format depends on your structure requirement.
Account_ID,Name,BillingCountry,Email,AccountNumber,Description
1001,TestAccountB11,CambodiaB11,Test1,A-001,Test description ACCOUNT object
- Create an Adapter on Google Control Board
Navigate to Google Control Board link
Go to Adapter tab then click New button for creating new Adapter
Create a new outbound Adapter with type Google Drive
For getting Client ID, Client Secret and Token please follow this guide: https://docs.skyvva-dev.com/docs/tutorial-v2-41-lightning/147-how-to-save-and-read-data-from-google-drive/147-3-how-to-get-token-for-oauth2/
- New: create a new file for each API call to Google drive
- Override: Overwrite content of the file base on file-Id on Google drive
We can find the Id of the Folder in Google Drive, by looking at the URL address when we go to that folder. For finding the “Id” of the File, we need to right-click on that file then choose “Get Link” after that we will see the “Id” of the File as an example below:
- Create an outbound Interface for Asynchronous mode, operation(upsert), choose Adapter, Metadata Provider, Repository, and Message Type
Do mapping
- Adding remote site
Navigate to Setup gear icon => Remote Site Settings=> New Remote Site
Add this endpoint below into remote site
https://www.googleapis.com
- Process data
Navigate to the Interface tab then press Manual Process
Choose Manually select the sObject using the Query Builder
Click Execute SOQL button, it will fetch the record base on the query statement and then choose the record for sending to Google Drive after that press button OK
Press button Send for pushing the record to Google drive
After click Send then navigate to Message Monitor tab on the Google control board to check the result
Checking the file on Google drive, the file was generated correctly.
- CSV file transformation was generated follow the MessageType structure. It generates the field that we have to do the mapping. For which field we did not map, it will not generate. Like on the example above, we have 6 fields but we map only 3 fields, and then the other field that we did not map will not generate into the File.
- The number of records created inside of the file was dependent on the field “Transfer Package Size” on the Interface. By default, this field is blank means that the value is “1”. The calculation of API call is depending on this field.
For example, in case we are sending 3 records Account’s id:
– If “Transfer Package Size=1”, it will execute 3 API calls and create 3 files each file contain one record
– If “Transfer Package Size=10”, it will execute 1 API call and create 1 file each file contain 3 records
Summary #
Finally, we have learned about how to save data to Google Drive. We have understood the MessageType generating from the file, create Google Adapter, create Interface, processing data, and checking results on Google Control Board. We have also known how to how to get the folder id and file id that is needed in the Google Adapter property.