Deploy to a Sandbox
- Get comfortable with CLI tools
- Deploy a repo using MDAPI to a Salesforce org
- Retrieve changes in an SF sandbox to a repo
- Mechanisms to retrieve metadata from an org
- Identifying the names of the component to be retrieved
- Deploying the updated repo to a different org
Time to Complete : 45 Minutes
- 1.Fork the [email protected] repo to your GitHub account
Instructions on how to fork a repo are available at the below link https://docs.github.com/en/github/getting-started-with-github/fork-a-repo
- 1.Clone the forked repo from your GitHub account to a local repo
- 2.Open up the project in VS Code
- 3.Authenticate your SFDX CLI in the terminal to one of the trailhead org's created in the prerequisites
- Use sfdx force:mdapi:deploy in your terminal (use the -h flag to understand usage) to deploy this code base to the orgsfdx force:mdapi:deploy -u <playground-1> -d mdapi -w 30
Did it fail? you will need to delete the jsconfig.json file in your
mdapi/lwc/jsconfig.json
sfdx force:user:permset:assign -u <playground-1> -n dreamhouse
sfdx force:data:tree:import -p ./data/sample-data-plan.json -u <playground-1>
- Set Compliance Categorization as PII to all fields in Property__c object
- Open Playground
- Setup --> Object Manager --> Search Property in Object finder--> Fields & Relationships --> Address --> Edit --> set Compliance Categorization as PII
- Follow this step in ALL the fields in Property object
- Create a field in property object and add it to layout
- Setup --> Object Manager --> Search Property in Object finder--> Fields & Relationships --> New --> with below details
FieldValueData typePicklist (Multi-Select)LabelFeaturesValuesAir conditioningCarport/GarageGarden/BackyardSolar panelsDeck/Pergola DishwasherSwimming poolBuilt-in barbecueWater featureGarden gnomesRestrict picklist✔️Visible Lines4- Edit property layout and add features field to information section under tags field
- Edit dreamhouse permissionset and add feature field with edit access
- Add daysOnMarket component to property explorer
- Open Dreamhouse app in App launcher
- Open Property Explorer tab
- Click Setup gear Icon --> Edit page --> search daysOnMarket in component finder --> add the component to right side panel
- Save the changes and click back
- Create a new Apex class
- Open Developer Console
- File --> New --> Apex class --> ContactController --> ok --> use below code and save the classpublic class ContactController {@AuraEnabledpublic static List<contact> getContacts(string searchKey){string key = '%'+ searchKey +'%' ;return [SELECT Id,Name FROM Contact WHERE Name LIKE :key ORDER BY Name LIMIT 50];}}
- Utilize sfdx force:mdapi:describemetadata and sfdx force:mdapi:listmetadata to create a new package.xml which should only include the changes to be retrieved from your playground-1.
- Utlize sfdx force:mdapi:retrieve (The reference to documentation is attached or use the -h flag to understand usage) to deploy this code base to the org.
- Once retrieved, ensure you copy the metadata to the right segments in your repo
sfdx force:mdapi:retrieve -w 30 -u <playground-1> -r <temp-directory> -k <path-to-your-new-package.xml>
- Utlize sfdx force:mdapi:deploy in your terminal (The reference to documentation is attached or use the -h flag to understand usage) to deploy this code base to the org.
sfdx force:mdapi:deploy -u <playground-2> -d mdapi -w 30
sfdx force:user:permset:assign -u <playground-2> -n dreamhouse
sfdx force:data:tree:import -p ./data/sample-data-plan.json -u playground-2
Once the metadata is successfully deployed your work into your , commit and push your changes to your [email protected] repo.
Awesome! You have completed your first challenge. Though this is cumbersome, this is typically easier than redoing your changes in the next environments (especially when you have many). In our subsequent challenges, we will look at how to make these practices simpler.
Last modified 2mo ago