Returning
What is Returning
Returning is an Import Integration feature that immediately returns values of newly inserted records from target to source during the current integration run. When the Returning feature is enabled, Skyvia performs import, reads the newly inserted records from the target, and then updates the source records with new values from the target.
How to Enable the Returning Feature
To enable the Returning feature, do the following:
- Select the Use Returning check box in the Mapping Definition tab of the Import Task Editor.
- Map the fields you want to return to the source.
Returning supports only the Column, Constant and Expression mapping types.
Requirements
To use the Returning feature, your Import Integration must meet the following requirements:
- Selected source is a database or a cloud app.
- Source object supports the update operation.
-
Source object must have a primary key. If there is no primary key in the source object (relevant for Google BigQuery, Amazon Redshift and SQL Azure, you can assign the column that is considered as primary key manually when mapping fields for returning.
- Simple task editor mode is selected on the Source Definition tab.
- INSERT or UPSERT operation is selected on the Target Definition tab.
Specifics
- The UPSERT operation performs both Insert and Update actions. When you import data using the UPSERT operation, Skyvia returns data from the inserted records only, not from the updated ones.
- Records updated in the source by the Returning feature are not counted toward your subscription limit. You pay only for the successfully inserted records in the target.
How to use Returning
Example 1. Return the Id of the newly created record.
Suppose a source database has a list of clients for import into the Salesforce Account object. There is a SalesforceId column in the database to track whether the record already exists in Salesforce. We create an import integration, which inserts clients into Salesforce and then returns the Ids of the imported accounts from Salesforce.
To accomplish this task, do the following:
- Create the integration, set source and target connections, and add the import task.
- Select source and target objects and set the INSERT operation.
- Map the fields for importing.
- Select Use Returning check box.
-
Map the field which you want to return to the source. We map the SalesforceId field to the Salesforce account Id field.
- Save the integration and run it.
As a result, we have the records imported to Salesforce.
And their Ids are returned to the source.
Example 2. Return the calculated field value.
Suppose a source database has a list of clients for import into the Salesforce Account object. We need to assign the client status in the database after importing it to Salesforce.
There is the Client_Status__c formula field in Salesforce. It takes the value “Premium” when the Type = “Technology Partner “ and Rating = “Hot”.
We import the Type and Rating values and then return the calculated Client_Status__c field to the source.
To accomplish this task, do the following:
- Create the integration, set source and target connections, and add the import task.
- Select source and target objects and set the INSERT operation.
-
Map the fields for importing.
- Select Use Returning check box.
-
Map the field which you want to return to the source. In our case, we map the Status field to the Salesforce account Client_Status__c field.
- Save the integration and run it.
As a result, we insert the Type and Rating values, Salesforce generates the Client_Status__c value, and then Skyvia returns this value to the source.