Salesforce provides on-demand software for customer relationship management (CRM), including contact management, product catalogs, order management, opportunity management, and sales management. DataWorks data integration supports reading from Salesforce data sources. This topic describes how to use Salesforce as a data source.
Supported field types
|
Field type |
DataWorks type |
|
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 develop a synchronization task in DataWorks, you must add the required data source to DataWorks by following the instructions in Data source management. You can view parameter descriptions in the DataWorks console to understand the meanings of the parameters when you add a data source.
You can create a Salesforce data source in one of the following ways:
-
Salesforce official: Log on to the Salesforce website to automatically obtain the access URL and create a data source.
-
Customize: If you want to set dedicated connection credentials for DataWorks, you can configure the Salesforce data source in Customize mode. You need to log in to Salesforce and create a Connected App to obtain security credentials (Consumer Key and Consumer Secret), which grants connection authorization to DataWorks. The configuration procedure is as follows:
Custom configuration
Salesforce is a third-party service. Ensure that the VPC for your resource group can connect to the Salesforce platform. Otherwise, you cannot create the data source.
Data synchronization tasks
For information about the entry point for and the procedure of configuring a synchronization task, see the following configuration guides.
Single-table offline synchronization task
-
See Configuring in wizard mode and Configuring in script mode for instructions.
-
The Appendix: Script demo and parameter descriptions provides a complete list of parameters and a script demo for script mode.
Appendix: Script demos and parameters
Configure a batch synchronization task by using the code editor
If you want to configure a batch synchronization task by using the code editor, you must configure the related parameters in the script based on the unified script format requirements. For more information, see Script mode configuration. The following information describes the parameters that you must configure for data sources when you configure a batch synchronization task by using the code editor.
Reader script demos
Example 1: Query a Salesforce object
{
"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: Query using Bulk API 1.0
{
"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: Query using Bulk API 2.0
{
"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: Query using a SOQL statement
{
"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"
}
]
}
}
Reader script parameters
|
Parameter |
Required |
Description |
Default |
|
datasource |
Yes |
The name of the data source. In script mode, you can add a data source. The value of this parameter must match the name of the added data source. |
None |
|
serviceType |
No |
The sync mode. Valid values:
|
sobject |
|
table |
Yes |
The Salesforce object, which is similar to a table name, such as |
None |
|
beginDateTime |
No |
|
None |
|
endDateTime |
No |
None |
|
|
splitPk |
No |
|
None |
|
blockCompoundColumn |
No |
Specifies the behavior when a compound data type is encountered. This parameter is used when
|
true |
|
bulkQueryJobTimeoutSeconds |
No |
|
86400 |
|
batchSize |
No |
|
300000 |
|
where |
No |
|
None |
|
query |
No |
|
None |
|
queryAll |
No |
|
false |
|
column |
Yes |
The columns that you want to synchronize. Specify the columns as a JSON array.
|
None |
|
connectTimeoutSeconds |
No |
|
30 |
|
socketTimeoutSeconds |
No |
|
600 |
|
retryIntervalSeconds |
No |
|
60 |
|
retryTimes |
No |
|
3 |