Add Customizations Post Installation
- Explain how to create and capture customizations with CumulusCI.
- Describe how to test the customizations and make them available for others.
Maddie has completed the first two steps of constructing her sundae. Now, it’s time to add her own favorite toppings that include a custom field on the Delivery Item object to track if produce is local. She’ll do this directly in a Salesforce scratch org and use CumulusCI to capture her customizations, test them, and push them to Production.
Create a Custom Field
Follow along as Maddie works.
The first step is to create the customizations. Do this declaratively using the clicks-not-code interface in Salesforce.
- If you still have the dev scratch org you set up in the previous unit, Create an Implementation Project, open, skip to step 4.
- Otherwise, start in GitHub Desktop. Make sure Current Repository is set to
Food-Bank-Implementationand open this repository by choosing Repository→Open in Visual Studio Code.
- Open your scratch org in a browser by entering this command in your VS Code Terminal:
cci org browser dev
- Open Setup.
- Go to the Object Manager.
- Click on the Delivery Item object from the Food Bank managed package.
- Click Fields & Relationships in the sidebar.
- Click the New button.
- Choose Checkbox then the Next button.
- Enter the details for the field:
Is Local Produce
Is_Local_Produce(accept the default)
- Click the Next button and Next again to accept the default profiles.
- Add the field to the Delivery Item page layout.
- Click Save.
Capture the Field as Unpackaged Metadata
Use CumulusCI to capture the changes you made in the scratch org.
- In GitHub Desktop, make sure Current Repository is set to
- Open this repository by choosing Repository→Open in Visual Studio Code.
- Review the changes you made to make sure they include all the customizations you want to capture. In the VS Code Terminal window, Type in this command:
cci task run list_changes --org dev
- Scroll in the the Terminal window to review the changes you’ll capture. These should include your new field as well as the Delivery Items page layout because you added the new field to the page layout. If it all looks good, capture the changes by typing in this command in the VS Code Terminal:
cci task run retrieve_changes --org dev -o exclude "Profile:"
When it’s done, go to GitHub desktop to view the changes.
With the changes all safe and sound in the Version Control System (GitHub Desktop, in this case), it’s safe to get rid of the
dev scratch org that you used. Do this by entering this command in VS Code’s Terminal Window:
cci org scratch_delete dev
Test the Changes
Before committing any changes to the main branch of a repository—or in this case the source of truth for Hunger Northeast’s Salesforce configuration—it’s important to test the work to make sure it’s ready for all users. To test that the newly captured metadata can be successfully deployed to a new org, Maddie will create a new QA scratch org. Follow along as she does this work.
- In VS Code’s Terminal window enter the command to create a scratch org in a QA org:
cci flow run qa_org --org qa
- Once the scratch org’s been created (it’ll take 10-15 minutes), enter the command to open the scratch org in a browser:
cci org browser qa
- Take a look around the scratch org, and you should find the new Is Local Produce field on the Delivery Item object.
Commit and Merge Changes
Now that you’ve tested the additional config on your personal computer, add the customization to your GitHub repository. First, create a feature branch and add your changes to it:
- Open your repository in GitHub Desktop. You should see your changes from the last module, which you pulled from the
- Select the tab named Current Branch: main.
- Click New Branch, to create a new branch off of main.
feature/localfor the branch name and click Create Branch.
- Select Bring my changes to feature/local. This tells GitHub Desktop that you want the changes you’ve already made to start out your new branch.
- Click Switch Branch to make sure you’re on the new feature/local branch.
Publish the changes and the new feature branch in GitHub:
- Enter a Commit Message and Description indicating what you've changed, perhaps something like
Created new checkbox on the Delivery Item object to track local produce.
- Click Commit to feature/local.
- Publish the feature branch to GitHub by clicking Publish branch on the information pane that comes up after your commit is complete.
- Once your branch is published, select Branch > Create Pull Request to create a new pull request for this change.
- GitHub Desktop will automatically navigate you to the Open a pull request screen in your web browser.
- Under the header Changes, add a line to describe what you did.
- Click Create Pull Request.
- On the next screen, click Merge pull request.
- Click Delete branch to remove the branch we just merged.
- Back in GitHub Desktop, choose Branch→Delete and confirm that you want to delete the branch
- GitHub Desktop automatically takes you back to the main branch. Choose Repository→Pull to bring down the changes you merged from feature/local on GitHub.
Lastly, in the GitHub menubar, choose Repository→Open in Visual Studio Code to open VS Code’s Terminal window, and delete your scratch org with this command:
cci org scratch_delete qa