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 |
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 Data Source Management.
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: If you wish to set up dedicated connection credentials for DataWorks, you can configure the Salesforce data source using the custom mode. You will need to log into your Salesforce system and create a Connected App to obtain security credentials (Consumer Key and Consumer Secret), which will grant Data-Works connection authorization.
Add a data source in custom mode
Salesforce is a third-party service. Please ensure that the VPC network bound to the resource group has connectivity to this platform. Otherwise, the data source creation will fail.
Data synchronization task development
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 using the codeless UI and Configuration in 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 based on the format requirements in the code editor. For more information about the format requirements, see Configure a task in the code editor. The following section provides details on the parameter configuration for the data source in the code editor.
Code for 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 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 |





