Inspired by the one and only Melanie Tolomeo who is chronicling her experience setting up NPSP from scratch, I decided to make a little field journal of my time working with CCI and Snowfakery. I was nervous and (if we’re all being honest here) procrastinated on this project, which makes it all the more exciting that in just 4 days of around 30 mins per night, I was able to get my bearings and employ Snowfakery to create data for me and deposit those data right into a friendly lil (mostly) empty Dev Org. (Prereq – limited experience with CCI – basically just completing the Trailhead and following a few groups’ worth of convo in the Power of Us Hub).

This is done just in the nick of time as I’ll be presenting on Snowfakery and ~how awesome it is!~ at today’s CCI Contributor Technical Training & Collaboration Day. So, buckle up and let’s go for a ride!

First – what is Snowfakery?!? Great Q! It’s a freeeeee & open source tool that creates large quantities of unique, fake data according to your specifications. It’s an awesome tool for loading up a Sandbox with data so that you can practice your Salesforce skillz without messing up your production instance. Generating and loading data is a time intensive (often manual) process no matter how you cut it, and Snowfakery can make that a LOT LOT easier.

Photo by Egor Kamelev on Pexels.com

Day 1: 1/11/21 8:14pm

Sitting at my desk with cold but not iced tea. Formerly hot tea, peppermint variety. Bunny slippers in the house!

Step one – pick initial goal. Make it the tiniest, possible goal. In this case: generate ONE record via Snowfakery.

Created a new Salesforce dev org. Opened command line terminal. Eyes glaze over. Need to create a YML file, apparently. Don’t know what that is, even though it’s been explained to me a few times, but determined to find out. (upon editing this, I now realize that I was spelling YML wrong… but for those of you who are reading along and have never heard of this, like me, it’s pronounced “yammle”)

[Phone a friend] New first step – create a new Github Repo and a Project. Aaron sent me a rudimentary YML file to get me started. Saved it in the same place as the Github Repo in hopes that it would show up in VS Code. Success! New problem – turns out that Snowfakery wasn’t included in the version of CCI that I had (or my computer couldn’t find it???). So I typed this into my commandline/terminal/thingy.

$ pipx install snowfakery

Success! CCI is now up to date and Snowfakery is downloaded.

Let’s try to create that record again.

$ snowfakery --output-format=JSON --output-file account.json account.yml

Account.yml is the recipe. Account.json is the output.

I have to see it to believe it. WOAH! Account.JSON now shows up in my VSCode directory. New account record exists with a totally random name. “Rodriguez LTD” and some address fields. I’ll take it.

New goal. Create fake data and push into my new dev org. Can I do it? Gotta call another friend for help on this one – got stuck again. Got unstuck by talking aloud/brainstorming with Michael.

$ cci task run generate_and_load_from_yaml -o generator_yaml account.yml -o num_records 1 -o num_records_tablename Account --org  
SnowfakeryDevOrg
  • -o means that we are defining an option within the CCI task
  • account.yml is the Snowfakery recipe that Aaron gave me
  • num_records and num_records_tablename are explained here
  • –org SnowfakeryDevOrg is my temporary Salesforce instance where the data belong

^^This code produced random Account records in my dev org!!!!

That’s a wrap for tonight!

Day 2: 1/12/2021 5:33 pm

Today’s goal: Create Accounts AND Contacts in my dev org.

First mission: Get waterbottle. Make sure that I can still run the scripts from yesterday. So far, so good.

Tried adding Contacts to the YML file and immediately got a bunch of errors. Got mixed up with Contact Name (FirstName LastName api field names) and indenting and assigning each Contact to an Account. Nothing quite worked, but luckily I had a backup YAML file that I could use as an example. Turns out that I accidentally created Contacts without Accounts (whoopsie!) and my second YML recipe actually worked acceptably well!

Ran the same code as yesterday, but added more and more detail to the recipe. Here’s a very simple version of my recipe (the file is called account_contact.yml).

- object: Account
  fields:
    Name:
      fake: company
    BillingStreet:
      fake: street_address
    BillingCity:
      fake: city
    BillingState:
      fake: state
    BillingPostalCode:
      fake: postalcode
    BillingCountry: United States
    ShippingCountry: United States
    Phone:
      fake: phone_number
    Fax:
      fake: phone_number
  friends:
    - object: Contact
      count: 2 #put 2 contacts in each account
      fields:
        AccountId:
          reference: Account
        Salutation:
          fake: prefix
        FirstName:
          fake: first_name
        LastName:
          fake: last_name
        Email:
          fake: email
        Phone:
          fake: phone_number
        MobilePhone:
          fake: phone_number
        Title:
          fake: job
        Birthdate:
          fake.date_between:
            start_date: -50y
            end_date: -20y

Once again, here’s that CCI task that I put into my terminal/command line.

$ cci task run generate_and_load_from_yaml -o generator_yaml account.yml -o num_records 1 -o num_records_tablename Account --org  
SnowfakeryDevOrg

Day 3: 1/13/2021 11:26 pm

Goal: Use Snowfakery to create Contacts, Accounts, Opportunities, Campaigns, and Opportunity Contact Roles.

Having a miserable time concentrating today while democracy, which was never really doing its job, seems to be unraveling toward something much, much worse … so I procrastinated on this until, well, now. Oopsy daisy.

Comfy pajamas on deck. Trying to make Opportunities…

I tried to use the “random choice” option like this:

    - object: Opportunity  
      count: 3
      fields:
        AccountId:
          reference: Account
        StageName:
          random_choice:
            -Prospecting
            -Qualification
            -Needs Analysis
            -Value Proposition
            -Id. Decision Makers
            -Perception Analysis
            -Proposal/Price Quote
            -Negotiation/Review
            -Closed Won
            -Closed Lost

And the opportunities generated had EVERY STAGE included, so that clearly went awry.

I am getting errors with selecting dates between “-10d” and “+10d” (which I think is supposed to be in the last 10 days or the next 10 days)… but for some reason it is fine with hardcoded dates, so I am just going to stick with that.

Back to the problem with stages… it seems happier if I add “:10%” next to each stage. However, I don’t think that’s in the docs… go figure??? I should bring this up with Paul. It’s nice to have a direct connection to the devs – it makes me more motivated and also makes me feel like I’m not a solo atom getting lost in the atmosphere. Uhhh that was a haunting simile.

I like this format in the VS Code application. I can change the YML recipe file in the top of the screen and then I can run the SAME EXACT thing in the command line every time.

Note to self: a sweet person on Twitter sent me this guide about VS Code for Admins and I think it would be helpful for me to return to it. For now, I’m just jumping off the diving board to see what happens. I already know the deep end is pretty deep!

My original goal was to create Campaigns and Contact Roles tonight but I am running low on steam. I might need to learn the “nicknames” functionality in Snowfakery to do that and that is too much for today. Maybe tomorrow!

Day 4: 1/14/2021 9:41 pm

Things are moving quickly and hard to keep track of. There are compelling convos happening on Twitter, in the Power of Us Hub, and some changes to Snowfakery have already been published partially as a result of this experience. I feel like I’m moving with the current now… which is really different from trying to figure out how the f*ck I’m going to get on this raft!

Originally my day 4 goal was to create Opportunity Contact Roles (the whole shebang) but then I saw that Paul created an OCR recipe already (woot woot!) and so that challenge is a little bit less relevant. So. New day, new goal. Today I would like to create Campaigns AND update the Oppty Primary Campaign Source accordingly. Can I do it? We’ll see!

When I start to work on the project every night, I feel a little bit trepidacious … like what if all of my progress from yesterday *POOF* disappears? I’m kind of shocked when I run the script and it works. o.o

First struggle of the day –

  • Snowfakery didn’t like it that I was missing a “dash” (-) (or was it a space?) … some sort of punctuation issue. I fixed it by doing a letter by letter comparison to an example. It didn’t “look wrong” to me
  • Indentation problem. Oy. I know that it is super important to get right but I don’t quite understand the rules yet. I think this will continue to be challenging for me.

Nevertheless, Accounts, Contacts, Oppties, and OCRs are now smooth as warm butter! Next, time to tackle those Campaigns.

AHGHGHGHAHHAHA!!!!!! This is my victory hoot and holler for figuring out Campaigns and Primary Campaign Source! I also threw in a few formula names into my recipe file. Some things are still a little funky…

  • Couldn’t figure out how to format currency field in Oppty Name (oh well)
  • Couldn’t figure out how to randomly assign Oppties to different Campaigns (oh well)

But the overall skeleton is there.

Records for 5 interrelated objects! In the click of a button!

Cue fireworks! Cue cupcakes! Cue confetti!

2 thoughts on “snowfakery till you makery

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s