Last active
July 10, 2017 23:08
-
-
Save jvolkov/39dc7d5119315b849c04ed542b0077ba to your computer and use it in GitHub Desktop.
Move Salesforce lead data from one Salesforce org to another using the Force.com CLI (https://force-cli.heroku.com)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# enter product username | |
echo -e "enter production username: " | |
read prod_user | |
# enter product password with security token | |
echo -e "enter production password followed by security token, no spaces: " | |
read prod_pass_token | |
# log into prod | |
/applications/force login -i=www.salesforce.com -u=$prod_user -p=$prod_pass_token | |
# get lead data from your Salesforce production | |
# update the query to include the data you want to copy | |
/applications/force query "select firstname, lastname, company, leadsource, phone from lead where isconverted=false and createddate = today" -format:csv > desktop/prodleads.csv | |
# Wait 30 seconds for the bulk job to finish | |
sleep 30s | |
# log out of prod | |
/applications/force logout -u=$prod_user | |
# enter sandbox username | |
echo -e "enter sandbox username: " | |
read sandbox_user | |
# enter sandbox password with security token | |
echo -e "enter sandbox password with security token: " | |
read sandbox_pass_token | |
# log into sandbox | |
/applications/force login -i=test.salesforce.com -u=$sandbox_user -p=$sandbox_pass_token | |
# import the recently assigned leads into sandbox | |
/applications/force bulk insert lead desktop/prodleads.csv | |
# Wait 30 seconds for the bulk job to finish | |
sleep 30s | |
# log out of sandbox | |
/applications/force logout -u=$sandbox_user |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# enter product username | |
echo -e "enter production username: " | |
read prod_user | |
# enter product password with security token | |
echo -e "enter production password followed by security token, no spaces: " | |
read prod_pass_token | |
# log into prod | |
/applications/force login -i=www.salesforce.com -u=$prod_user -p=$prod_pass_token | |
# get leads assigned today from production | |
/applications/force query "select firstname, lastname, company, leadsource, phone, hiring_plan__c, customerstatus__c, org_id__c, account_create_date__c, current_plan_start_time__c, hit_paywall_date__c, subscription_expiration__c, ip_address__c, website, price_tier__c, scammer__c, job_slots__c, job_description__c, draft_job_title__c, numberofemployees, free_trial_start_time__c, free_trial_expire_time__c, ab_test_flag__c, description, state, ip_address_location__c, infer__Infer_Score__c from lead where isconverted=false and createddate = today" -format:csv > desktop/prodleads.csv | |
# Wait 30 seconds for the bulk job to finish | |
sleep 30s | |
# log out of prod | |
/applications/force logout -u=$prod_user | |
# enter sandbox username | |
echo -e "enter sandbox username: " | |
read sandbox_user | |
# enter sandbox password with security token | |
echo -e "enter sandbox password with security token: " | |
read sandbox_pass_token | |
# log into sandbox | |
/applications/force login -i=test.salesforce.com -u=$sandbox_user -p=$sandbox_pass_token | |
# import the recently assigned leads into sandbox | |
/applications/force bulk insert lead desktop/prodleads.csv | |
# Wait 5 seconds for the bulk job to finish | |
sleep 30s | |
# log out of sandbox | |
/applications/force logout -u=$sandbox_user |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment