Salesforce, Python, SQL, & other ways to put your data where you need it

Need event music? 🎸

Live and recorded jazz, pop, and meditative music for your virtual conference / Zoom wedding / yoga class / private party with quality sound and a smooth technical experience

CCI dependency

29 Jun 2022 🔖 salesforce
💬 EN

Notes from CCI

Windows File Explorer – new folder

Open that empty folder in VSCode

Windows File Explorer – right-click, “Git Bash Here”, git init it, close Git Bash prompt

Windows File Explorer – View tab, check Hidden Items button in Show/hide, navigate to .git sub-folder, open config file in Notepad++, set it up the way I like it.

It said this:

[core]
	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	symlinks = false
	ignorecase = true

Make it say this instead:

[core]
	repositoryformatversion = 0
	filemode = false
	bare = false
	logallrefupdates = true
	symlinks = false
	ignorecase = true
[remote "origin"]
	url = https://[email protected]/my_company_github_org_name/name_i_will_probably_give_my_repo_on_github.git
	fetch = +refs/heads/*:refs/remotes/origin/*
[branch "main"]
	remote = origin
	merge = refs/heads/main
[user]
	name = K
	email = [email protected]

Save the file, close Notepad++.

Back to empty file tree in VSCode.

At the root level, create a .gitignore file (ok to borrow it more or less from another similar repo).

At the root level, create a cumulusci.yml file (ok to borrow it more or less from another similar repo). This is where my dependencies on other repositories go.

At the root level, create a sfdx-project.json file (ok to borrow it more or less from another similar repo).

Create an \orgs\ sub-folder filled with beta.json, dev.json, feature.json, and release.json files (ok to borrow it all more or less from another similar repo). This is where things like having enableAdminLoginAsAnyUser gets flipped to true, where you can make sure “communities” is flipped on as needed by various dependencies when you spin up a scratch org, etc.

Create a \.sfdx\ sub-folder with just one file in it so far: sfdx-config.json (ok to borrow it more or less from another similar repo). This is where I specify which of my various developer orgs, corporate production orgs, etc. is going to be serving as the “hub org” for coordinating the creation of scratch orgs.

Create a chain of sub-folders: \force-app\main\default\classes with 2 files in it: Hello_TEST.cls and Hello_TEST.cls-meta.xml.

@isTest
public class Hello_TEST {
    
    static testMethod void runTest() {
        System.assertEquals(0,0);
    }
    
}
<?xml version="1.0" encoding="UTF-8"?>
<ApexClass xmlns="http://soap.sforce.com/2006/04/metadata">
    <apiVersion>53.0</apiVersion>
    <status>Active</status>
</ApexClass>

In VSCode, Ctrl+` to open up a new Terminal pane on the screen.

From the command prompt within this new folder I set up as my very first step, run this command:

cci flow run dev_org --org feature

And then I wait, and wait, and wait, because my dependencies were huge packages.

PS C:\example\my-new-folder> cci flow run dev_org --org feature
[06/29/22 12:14:25] ============================================================
                    Initializing flow: FlowCoordinator (dev_org)
                    Set up an org as a development environment for unmanaged metadata
                    ============================================================

                    Verifying and refreshing credentials for the specified org: feature.
                    Creating scratch org with command: sfdx force:org:create  -f orgs/feature.json -w 120 -n --durationdays 1 -a My-New-Package__feature
                    [email protected]
[06/29/22 12:15:00] Successfully created scratch org: 001234567890987654321, username: [email protected]
                    Generating scratch org user password with command: sfdx force:user:password:generate -u [email protected]
[06/29/22 12:15:12] Failed to set password:
                    ERROR running force:user:password:generate:  Unexpected end of JSON input
                    Getting org info from Salesforce CLI for [email protected]
[06/29/22 12:15:21] Org info updated, writing to keychain
                    ------------------------------------------------------------
                    Organization:
                      Username: [email protected]
                        Org Id: 001234567890987654321
                      Instance: CS50
                    ------------------------------------------------------------

                    ------------------------------------------------------------
                    Steps:
                    Description: Set up an org as a development environment for unmanaged metadata

                    Flow Steps
                    1) flow: dependencies [from current folder]
                        1) task: update_dependencies
                        2) task: deploy_pre
                    2) flow: deploy_unmanaged
                        0) task: dx_convert_from
                           when: project_config.project__source_format == "sfdx" and not org_config.scratch
                        1) task: unschedule_apex
                        2) task: update_package_xml
                           when: project_config.project__source_format != "sfdx" or not org_config.scratch
                        3) task: deploy
                           when: project_config.project__source_format != "sfdx" or not org_config.scratch
                        3.1) task: deploy
                             when: project_config.project__source_format == "sfdx" and org_config.scratch
                        4) task: uninstall_packaged_incremental
                           when: project_config.project__source_format != "sfdx" or not org_config.scratch
                        5) task: snapshot_changes
                    3) flow: config_dev
                        1) task: deploy_post
                        2) task: update_admin_profile
                    4) task: snapshot_changes
                    ------------------------------------------------------------

                    Starting execution
                    ============================================================

                    ------------------------------------------------------------
                    Running task: update_dependencies
                    ------------------------------------------------------------

                    Options:
                      resolution_strategy: preproduction
                      packages_only: False
[06/29/22 12:15:22] Beginning task: UpdateDependencies

                    Resolving dependencies...
[06/29/22 12:15:23] Collecting dependencies from Github repo https://github.com/ThirdParty/TheirRepo
                    Collected dependencies:
                        ...(stuff here)...
                    Deploying unmanaged metadata from ...(stuff here)...
[06/29/22 12:15:27] Cleaning meta.xml files of packageVersion elements for deploy
                    Pending
[06/29/22 12:15:28] [Pending]: next check in 1 seconds
[06/29/22 12:15:29] [InProgress]: Processing Type: CustomObject
[06/29/22 12:15:30] [InProgress]: Processing Type: CustomObjectTranslation
[06/29/22 12:15:32] [Done]
[06/29/22 12:15:33] [Success]: Succeeded
                    Deploying unmanaged metadata from ...(stuff here)...
[06/29/22 12:15:36] Cleaning meta.xml files of packageVersion elements for deploy
                    Pending
[06/29/22 12:15:37] [Pending]: next check in 1 seconds
[06/29/22 12:15:38] [InProgress]: Processing Type: CustomObject
[06/29/22 12:15:39] [InProgress]: Processing Type: CustomObjectTranslation
[06/29/22 12:15:41] [Done]
[06/29/22 12:15:42] [Success]: Succeeded
                    Installing (package name) (package version number)
                    Pending
                    [Pending]: next check in 1 seconds
[06/29/22 12:15:44] [Pending]: next check in 1 seconds
[06/29/22 12:15:45] [InProgress]: Processing Type: InstalledPackage
[06/29/22 12:15:46] [InProgress]: Processing Type: InstalledPackage
...(and so on and so forth for an hour)...

If it doesn’t error out on me, I guess I’ll want to try:

cci task run run_tests --org feature --test_name_match Hello_TEST
--- ---