Go Back
Salesforce Org to Org Migration with Record Types
Publisher
: Lingk
Run In Lingk
Description
This recipe interacts with two orgs with different data models and record types. To use this recipe, Add one org to the environment and add the second org to the inline credentials.
Browse the knowledge base
Twitter
E-Mail
# _____ _ _____ __ # | __ \ (_) |_ _| / _| # | |__) |___ ___ _ _ __ ___ | | _ __ | |_ ___ # | _ // _ \/ __| | '_ \ / _ \ | | | '_ \| _/ _ \ # | | \ \ __/ (__| | |_) | __/ _| |_| | | | || (_) | # |_| \_\___|\___|_| .__/ \___| |_____|_| |_|_| \___/ # | | # |_| # Project Name - SALESFORCE ORG TO ORG MIGRATION WITH RECORD TYPES # Recipe URL - https://app.lingk.io/a/10932/tf/17475 # Description - This recipe interacts with two orgs with different data models and record types. # To use this recipe, Add one org to the environment and add the second org to the inline credentials. # Industry - Higher Ed # Business Process - Graduate Reporting # Systems - Salesforce # Connectors - Salesforce # Data Flows - Single Direction # Connection Type - API to API # Salesforce Objects #1. Account #2. RecordType # Add Recipe notes / Change log information here! # _____ _ # / ____| | | # | | ___ _ __ _ __ ___ ___| |_ ___ _ __ ___ # | | / _ \| '_ \| '_ \ / _ \/ __| __/ _ \| '__/ __| # | |___| (_) | | | | | | | __/ (__| || (_) | | \__ \ # \_____\___/|_| |_|_| |_|\___|\___|\__\___/|_| |___/ # # CONNECTORS specify what data will be pulled into the in-memory database during processing connectors: # Configure Salesforce credentials in your Environment before running this recipe # Salesforce Setup - https://help.lingk.io/en/articles/267-salesforce-connector-setup-guide ###### Start - Salesforce Reader connectors ###### # Salesforce connectors - name: accountNameSource type: salesforceReader properties: query: > SELECT Id, Name FROM Account where RecordTypeId in (SELECT Id FROM RecordType where isactive = true and SobjectType = 'Account' and Name = 'Educational Institution') isSandbox: true useBearerToken: true # this connector will pull org1 credentials from the environment - name: org1RecordType type: salesforceReader properties: query: SELECT Id, Name FROM RecordType where isactive = true and SobjectType = 'Account' and Name = 'Educational Institution' useBearerToken: true isSandbox: false # this connector will pull org2 credentials from the environment - name: org2RecordType type: salesforceReader properties: username: {{env.vars.username}} password: {{env.vars.passwordSecurityKey}} query: SELECT Id, Name FROM RecordType where isactive = true and SobjectType = 'Account' and Name = 'Educational Institution' isSandbox: false # *** Bundle: Accounts - name: accountsOrg1 type: salesforceReader properties: query: SELECT Id, Name, RecordTypeId FROM Account isSandbox: false useBearerToken: true - name: accountsOrg2 type: salesforceReader properties: username: {{env.vars.username}} password: {{env.vars.passwordSecurityKey}} query: SELECT Id, Name, RecordTypeId FROM Account isSandbox: false ###### End - Salesforce Reader connectors ###### ###### Start - Salesforce Writer connectors ###### # Type: Org2 Destination Writer - name: sfAccountWriter type: salesforceBulkWriter properties: onError: continue sfObject: Account isSandbox: false username: {{env.vars.username}} password: {{env.vars.passwordSecurityKey}} # batchSize: 50 # default 10000 # upsert: true # default false - requires external Id in sfObject ###### End - Salesforce Writer connectors ###### # _____ _ _ _ # / ____| | | | | | # | (___ | |_ __ _| |_ ___ _ __ ___ ___ _ __ | |_ ___ # \___ \| __/ _` | __/ _ \ '_ ` _ \ / _ \ '_ \| __/ __| # ____) | || (_| | || __/ | | | | | __/ | | | |_\__ \ # |_____/ \__\__,_|\__\___|_| |_| |_|\___|_| |_|\__|___/ # STATEMENTS specify how the data should be processed while in memory statements: #******************************************************************** D I S C L A I M E R *********************************************************************************************** # * # Note that in an effort to keep recipes optimized for DPH (Data Processing Hours), print statements should be commented out after development has concluded for a recipe. * # For more information on DPH optimization, please visit the following help article - https://help.lingk.io/en/articles/212-minimizing-data-processing-hours-on-the-lingk-platform * # * #******************************************************************** D I S C L A I M E R *********************************************************************************************** # *** INIT: Relationship Initialization #- statement: print org1RecordType #- statement: print accountNameSource # *** BUNDLE: Contact # no transformation really needed for an org to org? - statement: | (transformed) => select Id, Name, RecordTypeId from accountsOrg1 #- statement: print transformed # make record type be the org2 recordtype - statement: | (newAccounts) => SELECT (select id from org2RecordType limit 1) RecordTypeId, transformed.Name FROM transformed.transformed INNER JOIN accountsOrg2 ON transformed.Name = accountsOrg2.Name #- statement: print newAccounts #- statement: (results, errors) => INSERT newAccounts INTO sfAccountWriter # The 'LEFT ANTI JOIN' function retrieves the rows from the first table (table after the FROM statement) that do not match with the rows on the second table (right table) - statement: | (existingAccounts) => SELECT transformed.Id, transformed.RecordTypeId, transformed.Name FROM transformed LEFT ANTI JOIN accountsOrg2 ON transformed.Name = accountsOrg2.Name #- statement: print existingAccounts #- statement: (results, errors) => UPDATE existingAccounts INTO sfAccountsWriter # Add more statements to convert, join, aggregrate, transform, and integrate your data
JSON API to SOAP APIs and SOAP XML processing
Date Formatting Examples