Skip to content

Instantly share code, notes, and snippets.

@chevcast
Last active April 14, 2020 21:20
Show Gist options
  • Save chevcast/9686d46f4e03c193431ea4c87ae241a2 to your computer and use it in GitHub Desktop.
Save chevcast/9686d46f4e03c193431ea4c87ae241a2 to your computer and use it in GitHub Desktop.

Create new object called Referrer__c

Fields:

  • Contact__c

    Contact__r relationship to Contact object.

  • Vivint_Employee__c

    Vivint_Employee__r relationship to Vivint_Employee__c object.

  • Personalized_URL__c

    Formula field that tacks Username__c onto the end of either https://referrals.vivintsolar.com/ or https://referrals.stage.vivintsolar.com/

  • Username__c

    Unique text field

  • First_Name__c

    Text field

  • Last_Name__c

    Text field

  • Email__c

    Email field

  • Default_Lead_Generator__c

    Default_Lead_Generator__r relationship to Vivint_Employee__c object.

  • Default_Sales_Rep__c

    Default_Sales_Rep__r relationship to Vivint_Employee__c object.

Data load to be done by Evan:

  1. Create Referrer__c record for every Contact
    • Default the Username__c field to the contact email.
    • Default Default_Lead_Generator__c and Default_Sales_Rep__c with sales rep from Opportunity
  2. Create Referrer__c record for every Vivint_Employee__c that is not a Dealer
    • Default the Username__c field to the employee firstname.lastname (e.g. alex.ford)
    • Default Default_Lead_Generator__c and Default_Sales_Rep__c with themselves. Circular relationship back to the Vivint_Employee__c this Referrer__c record is being created for.
  3. Create Referrer__c record for every Vivint_Employee__c that is a Dealer
    • Default the Username__c field to the dealer email address.
    • Default Default_Lead_Generator__c and Default_Sales_Rep__c with themselves. Circular relationship back to the Vivint_Employee__c this Referrer__c record is being created for.

Data load to be done by Chev:

  1. Create a Referrer__c record for any customer Okta record whose email does not match a Contact record.
    • Populate First_Name__c, Last_Name__c, and Email__c text fields.
    • Default Username__c field to customer Okta email.
  2. Update Username__c fields for all Referrer__c records that have already customized personal URLs in our Amigo CouchDB table.

Create new object called Referral_Submission__c

Fields:

  • Referrer__c

    Referrer__r relationship to Referrer__c object.

  • Lead__c

    Lead__r relationship to Lead object.

  • Opportunity__c

    Opportunity__r relationship to Opportunity object.

Data Load to be done by Chev:

  1. Create Referral_Submission__c records for all entries in the amigo_referrals CouchDB table.
    • Populate Lead__c with leadId from Couch record.
    • Locate Referrer__c record associated with customer Okta account if repId is false.
    • If repId is not false then locate the Referrer__c record associated with the Vivint_Employee__c record for that repId.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment