Importing Complex Records to Salesforce (V2)
This task will update or insert multiple records of different types in Salesforce, and create relationships between them. For example, you can use this task to upload opportunities and opportunity item lines, and link them to a particular account and pricebook.
Existing records are matched with those provided in the input file, based on the Salesforce field specified as the key field in the input file. If no key field is specified, the Id will be used for matching. If a match is found, the existing record will be updated, or if no match is found a new record will be inserted.
The task supports looking up values from existing records in Salesforce, based on any fields of your choice. For example, if you want to set the account ID when uploading an opportunity, but you only know the account name, you can use a lookup to find the ID of the account with the name specified.
XML
Settings
Salesforce Connection
Required
The Salesforce connection to use, see Connecting to Salesforce
Salesforce (Bulk) Connection
Optional
The Bulk Salesforce connection to use, see Connecting to Salesforce (Bulk). Setting a bulk connection will allow the task to automatically switch to the bulk API when there's a large amount of data to upload to Salesforce. This will increase the speed of the upload, and reduce the number of API requests it uses.
Fail File
Required
The file to output any records to that fail to import to Salesforce.
Input File
Required
The XML file containing the records to import to Salesforce. A sample of the XML format is shown below.
Success File
Required
The file to output successfully imported records to.
Bulk Batch Size
Required
The maximum number of records to send to the bulk API in a single batch. The value must be between 1 and 5000. Defaults to 5000.
This setting is only applicable when a bulk connection has been provided via the Salesforce (Bulk) Connection setting, and the number of records to insert or update exceeds the value in the Bulk Threshold setting.
Bulk Concurrency Mode
Required
The concurrency mode for bulk jobs. Use serial mode if you experience errors related to locking.
This setting is only applicable when a bulk connection has been provided via the Salesforce (Bulk) Connection setting, and the number of records to insert or update exceeds the value in the Bulk Threshold setting.
Bulk Threshold
Required
The number of records that will prompt the task to use the bulk API instead of the REST API. Defaults to 1000.
Operation Type
Required
The operation to perform against Salesforce, when an operation hasn't been specified in the input file. The following options are available:
- Insert - Only create new records in Salesforce
- Update - Only update existing records in Salesforce
- Upsert - Create new or update existing records in Salesforce. This is the default option.
REST Batch Size
Required
The maximum number of records to send to the REST API in a single batch. The value must be between 1 and 200. Defaults to 200.
Zynk Settings
Examples
A sample input file containing an opportunity and 2 line items is shown below. For detailed information on the XML schema, see Salesforce Complex Object XML.
<?xml version="1.0"?>
<SalesforceObjects Type="Opportunity" Key="Name">
<SalesforceObject Operation="Upsert">
<Field Name="Name" Value="Order 12345" Truncation="Right" />
<Field Name="CloseDate" Value="2023-02-14" />
<Field Name="StageName" Value="closed won" PicklistValueCaseSensitive="false" />
<LookupField Name="AccountId" Select="Id" From="Account" MatchType="Single">
<WhereField Name="Name" Value="19 Computing" />
</LookupField>
<LookupField Name="Pricebook2Id" Select="Id" From="Pricebook2">
<WhereField Name="Name" Value="Standard Price Book" />
</LookupField>
<RelatedObject Type="OpportunityLineItem" Key="Id" Operation="Upsert">
<LookupField Name="Id" Select="Id" From="OpportunityLineItem">
<WhereField Name="OpportunityId" Value="{ParentId}" Comparison="Equals" />
<LookupField Name="PricebookEntryId" Select="Id" From="PricebookEntry" MatchType="Index" MatchIndex="0">
<WhereField Name="Pricebook2.Name" Value="Standard Price Book" Comparison="Equals" />
<WhereField Name="CurrencyIsoCode" Value="GBP" Comparison="Equals" />
<WhereField Name="Product2.ProductCode" Value="IPHONE4" Comparison="Equals" />
</LookupField>
</LookupField>
<Field Name="Description" Value="iPhone 4" />
<Field Name="OpportunityId" Value="{ParentId}" />
<Field Name="Quantity" Value="1" />
<Field Name="UnitPrice" Value="250" />
<LookupField Name="PricebookEntryId" Select="Id" From="PricebookEntry" MatchType="Index" MatchIndex="0">
<WhereField Name="Pricebook2.Name" Value="Standard Price Book" Comparison="Equals" />
<WhereField Name="CurrencyIsoCode" Value="GBP" Comparison="Equals" />
<WhereField Name="Product2.ProductCode" Value="IPHONE4" Comparison="Equals" />
</LookupField>
</RelatedObject>
<RelatedObject Type="OpportunityLineItem" Key="Id" Operation="Upsert">
<LookupField Name="Id" Select="Id" From="OpportunityLineItem">
<WhereField Name="OpportunityId" Value="{ParentId}" Comparison="Equals" />
<LookupField Name="PricebookEntryId" Select="Id" From="PricebookEntry" MatchType="Index" MatchIndex="0">
<WhereField Name="Pricebook2.Name" Value="Standard Price Book" Comparison="Equals" />
<WhereField Name="CurrencyIsoCode" Value="GBP" Comparison="Equals" />
<WhereField Name="Product2.ProductCode" Value="00299" Comparison="Equals" />
</LookupField>
</LookupField>
<Field Name="Description" Value="WIHA Screwdriver" />
<Field Name="OpportunityId" Value="{ParentId}" />
<Field Name="Quantity" Value="1" />
<Field Name="UnitPrice" Value="0.01" />
<LookupField Name="PricebookEntryId" Select="Id" From="PricebookEntry" MatchType="Index" MatchIndex="0">
<WhereField Name="Pricebook2.Name" Value="Standard Price Book" Comparison="Equals" />
<WhereField Name="CurrencyIsoCode" Value="GBP" Comparison="Equals" />
<WhereField Name="Product2.ProductCode" Value="00299" Comparison="Equals" />
</LookupField>
</RelatedObject>
</SalesforceObject>
</SalesforceObjects>