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

enable returning feature

To enable the Returning feature, do the following:

  1. Select the Use Returning check box in the Mapping Definition tab of the Import Task Editor.
  2. 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.

    primary key

  • 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.

database example before returning

To accomplish this task, do the following:

  1. Create the integration, set source and target connections, and add the import task.
  2. Select source and target objects and set the INSERT operation.
  3. Map the fields for importing.
  4. Select Use Returning check box.
  5. Map the field which you want to return to the source. We map the SalesforceId field to the Salesforce account Id field. example1 mapping

  6. Save the integration and run it.

As a result, we have the records imported to Salesforce.

import result

And their Ids are returned to the source.

returning result

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.

database example2 before

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:

  1. Create the integration, set source and target connections, and add the import task.
  2. Select source and target objects and set the INSERT operation.
  3. Map the fields for importing.

    example2 mapping

  4. Select Use Returning check box.
  5. 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.

    example2 returning mapping

  6. 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.

returning result2