Salesforce provides customer relationship management (CRM) software that is focused on contact management, product catalog management, order management, opportunity management, and sales management. DataWorks provides Salesforce Reader for you to read data from Salesforce data sources. This topic describes the capabilities of synchronizing data from Salesforce data sources.
Data type mappings
Data type | Data type in code editor |
address | STRING |
anyType | STRING |
base64 | BYTES |
boolean | BOOL |
combobox | STRING |
complexvalue | STRING |
currency | DOUBLE |
date | DATE |
datetime | DATE |
double | DOUBLE |
STRING | |
encryptedstring | STRING |
id | STRING |
int | LONG |
json | STRING |
long | LONG |
multipicklist | STRING |
percent | DOUBLE |
phone | STRING |
picklist | STRING |
reference | STRING |
string | STRING |
textarea | STRING |
time | DATE |
url | STRING |
geolocation | STRING |
Develop a data synchronization task
For information about the entry point for and the procedure of configuring a data synchronization task, see the following sections. For information about the parameter settings, view the infotip of each parameter on the configuration tab of the task.
Add a data source
Before you configure a data synchronization task to synchronize data from a specific data source, you must add the data source to DataWorks. For more information, see Add and manage data sources.
Salesforce allows you to add a data source by using one of the following methods:
Salesforce official: Log on to the Salesforce official website to obtain the access address of Salesforce. Then, add a data source based on the access address.
Custom: Specify the consumer key and consumer secret of a connected application to obtain the access address of Salesforce. Then, add a data source based on the access address.
Add a data source in custom mode
Configure a batch synchronization task to synchronize data of a single table
For more information about the configuration procedure, see Configure a batch synchronization task by using the codeless UI and Configure a batch synchronization task by using the code editor.
For information about all parameters that are configured and the code that is run when you use the code editor to configure a batch synchronization task, see Appendix: Code and parameters.
Appendix: Code and parameters
Configure a batch synchronization task by using the code editor
If you use the code editor to configure a batch synchronization task, you must configure parameters for the reader of the related data source based on the format requirements in the code editor. For more information about the format requirements, see Configure a batch synchronization task by using the code editor. The following information describes the configuration details of parameters for the reader in the code editor.
Code for Salesforce Reader
Example 1: Query Salesforce objects
{
"type":"job",
"version":"2.0",
"steps":[
{
"stepType":"salesforce",
"parameter":{
"datasource":"",
"serviceType": "sobject",
"table": "Account",
"beginDateTime": "20230817184200",
"endDateTime": "20231017184200",
"where": "",
"column": [
{
"type": "STRING",
"name": "Id"
},
{
"type": "STRING",
"name": "Name"
},
{
"type": "BOOL",
"name": "IsDeleted"
},
{
"type": "DATE",
"name": "CreatedDate"
}
]
},
"name":"Reader",
"category":"reader"
},
{
"stepType":"stream",
"parameter":{},
"name":"Writer",
"category":"writer"
}
],
"setting":{
"errorLimit":{
"record":"0"
},
"speed":{
"throttle":true,
"concurrent":1,
"mbps":"12"
}
},
"order":{
"hops":[
{
"from":"Reader",
"to":"Writer"
}
]
}
}
Example 2: Use Bulk API 1.0 to query Salesforce objects
{
"type":"job",
"version":"2.0",
"steps":[
{
"stepType":"salesforce",
"parameter":{
"datasource":"",
"serviceType": "bulk1",
"table": "Account",
"beginDateTime": "20230817184200",
"endDateTime": "20231017184200",
"where": "",
"blockCompoundColumn":true,
"bulkQueryJobTimeoutSeconds":86400,
"column": [
{
"type": "STRING",
"name": "Id"
},
{
"type": "STRING",
"name": "Name"
},
{
"type": "BOOL",
"name": "IsDeleted"
},
{
"type": "DATE",
"name": "CreatedDate"
}
]
},
"name":"Reader",
"category":"reader"
},
{
"stepType":"stream",
"parameter":{
"print": true
},
"name":"Writer",
"category":"writer"
}
],
"setting":{
"errorLimit":{
"record":"0"
},
"speed":{
"concurrent":1
}
},
"order":{
"hops":[
{
"from":"Reader",
"to":"Writer"
}
]
}
}
Example 3: Use Bulk API 2.0 to query Salesforce objects
{
"type":"job",
"version":"2.0",
"steps":[
{
"stepType":"salesforce",
"parameter":{
"datasource":"",
"serviceType": "bulk2",
"table": "Account",
"beginDateTime": "20230817184200",
"endDateTime": "20231017184200",
"where": "",
"blockCompoundColumn":true,
"bulkQueryJobTimeoutSeconds":86400,
"column": [
{
"type": "STRING",
"name": "Id"
},
{
"type": "STRING",
"name": "Name"
},
{
"type": "BOOL",
"name": "IsDeleted"
},
{
"type": "DATE",
"name": "CreatedDate"
}
]
},
"name":"Reader",
"category":"reader"
},
{
"stepType":"stream",
"parameter":{},
"name":"Writer",
"category":"writer"
}
],
"setting":{
"errorLimit":{
"record":"0"
},
"speed":{
"throttle":true,
"concurrent":1,
"mbps":"12"
}
},
"order":{
"hops":[
{
"from":"Reader",
"to":"Writer"
}
]
}
}
Example 4: Execute a Salesforce Object Query Language (SOQL) statement to query data
{
"type":"job",
"version":"2.0",
"steps":[
{
"stepType":"salesforce",
"parameter":{
"datasource":"",
"serviceType": "query",
"query": "select Id, Name, IsDeleted, CreatedDate from Account where Name!='Aliyun' ",
"column": [
{
"type": "STRING",
"name": "Id"
},
{
"type": "STRING",
"name": "Name"
},
{
"type": "BOOL",
"name": "IsDeleted"
},
{
"type": "DATE",
"name": "CreatedDate"
}
]
},
"name":"Reader",
"category":"reader"
},
{
"stepType":"stream",
"parameter":{},
"name":"Writer",
"category":"writer"
}
],
"setting":{
"errorLimit":{
"record":"0"
},
"speed":{
"throttle":true,
"concurrent":1,
"mbps":"12"
}
},
"order":{
"hops":[
{
"from":"Reader",
"to":"Writer"
}
]
}
}
Parameters in code for Salesforce Reader
Parameter | Required | Description | Default value |
datasource | Yes | The name of the data source. It must be the same as the name of the added data source. You can add data sources by using the code editor. | No default value |
serviceType | No | The synchronization mode. Valid values:
| sobject |
table | Yes | The Salesforce object, such as Account, Case, or Group. Objects are equivalent to tables. This parameter is required if you set the serviceType parameter to sobject, bulk1, or bulk2. | No default value |
beginDateTime | No |
| No default value |
endDateTime | No | No default value | |
splitPk | No |
| No default value |
blockCompoundColumn | No | Specifies whether to support columns of combined data types. This parameter is required if you set the serviceType parameter to bulk1 or bulk2. Valid values:
| true |
bulkQueryJobTimeoutSeconds | No |
| 86400 |
batchSize | No |
| 300000 |
where | No |
| No default value |
query | No |
| No default value |
queryAll | No |
| false |
column | Yes | The names of the columns that you want to synchronize. Specify the names in a JSON array.
| No default value |
connectTimeoutSeconds | No |
| 30 |
socketTimeoutSeconds | No |
| 600 |
retryIntervalSeconds | No |
| 60 |
retryTimes | No |
| 3 |