Develop and Test Changes Locally
Learning Objectives
- Create a change set, including any dependencies for your customization.
- Authorize a deployment connection to another environment.
- Upload a change set to an org.
- Describe when it’s necessary to clone a change set.
Develop in Isolation
Once planning is complete, Calvin and Ella move to the next stages, development and local testing. When they are done with these stages, they’ve each got a change set uploaded to the integrated test environment and a list of manual changes required to deploy their app.
Create Customizations
To support Zephyrus’s new language training initiative, Calvin creates two custom objects:
- A Language Course object that stores information about specific Zephyrus language courses.
- A Language Course Designer object that stores information about specific language course designers at Zephyrus.
Let’s follow Calvin as he creates these custom objects, fleshes them out, and prepares them for deployment.
Create the Custom Objects
Let’s start with the Language Course object. Calvin creates this object in a Developer sandbox.
- After logging in to the sandbox, launch Setup.
- Click the Object Manager tab.
- Click Create | Custom Object in the top-right corner.
- For Label, enter Language Course. Notice that the Object Name and Record Name fields auto-fill.
- For Plural Label, enter Language Courses.
- Check the box for Launch New Custom Tab Wizard, then click Save.
- Select your desired tab style (Calvin’s choice is Chalkboard, since this custom object represents a course) and click Next, Next, and Save.
Next, Calvin creates the Language Course Designer object.
- From Setup, click the Object Manager tab.
- Click Create | Custom Object in the top-right corner.
- For Label, enter Language Course Designer. Notice that the Object Name and Record Name fields auto-fill.
- For Plural Label, enter Language Course Designers.
- Check the box for Launch New Custom Tab Wizard, then click Save.
- Select your desired tab style (Calvin’s choice is Presenter) and click Next, Next, and Save.
Once Calvin has completed these changes, he notes them in the team’s change tracking tool.
Define the Custom Object Fields
Calvin and the stakeholders worked out the field definitions for both custom objects during the Plan step, which makes it easy for Calvin to create the fields.
One important field on the Language Course object specifies which Language Course Designer authored the class. Let’s look at how Calvin creates this field relating the two new custom objects.
- From Setup, go to Object Manager | Language Course.
- Click Fields & Relationships. Notice that some fields are already there, including a name field.
- Click New in the top right corner.
- For data type, select Master-Detail Relationship.
- Click Next.
- Select Language Course Designer from the Related To menu and click Next.
- Fill out the following.
- Field Label: Language Course Designer
- Description: The author of this language course.
- Click Next, Next, Next, and Save.
Again, Calvin notes the changes he made in the team’s change tracking tool.
Test the Custom Objects Locally
Calvin tests his new custom objects in his own environment to confirm that they work as intended, making changes as needed. When he’s confirmed that his customization meets the requirements, Calvin gathers his changes into an artifact, a change set. Then he can easily move this artifact to the shared Developer Pro sandbox, where it can be integrated with other customizations in the release.
Create an Outbound Change Set
In his Developer sandbox, Calvin creates a new change set that he can migrate to the Developer Pro sandbox. This change set contains any new and changed metadata components from Calvin’s customization work. To successfully create the change set, Calvin must include all components needed to make the customization work in the target environment.
Calvin reviews a report in the change tracking tool and sees there are two sets of things to add to the new outbound change set.
- The custom objects themselves
- The components supporting the custom objects he created
The new Language Course custom object has a Master-Detail relationship with the Language Course Designer custom object. This means that Language Course components have a dependency on Language Course Designer components. That dependency means that Language Course components can’t exist in an org unless the Language Course Designer components also exist in the org.
- From Setup, enter Outbound Change Sets in the Quick Find box, then select Outbound Change Sets.
- Click New.
- Enter a name for your change set and click Save. Calvin names the change set Language Training.
- In the Change Set Components section, click Add.
- Choose the type of component, the components you want to add, and click Add To Change Set. Calvin chooses Custom Object as the component type, selects both Language Course and Language Course Designer, and clicks Add to Change Set.
- Click View/Add Dependencies to see whether the components you’ve added to the change set are dependent on other customizations.
- Select the dependent components you want to add and click Add To Change Set.
Calvin selects all the dependencies, because he knows none of them exist yet in the sandbox used for testing.
Delete or Rename Components
Here’s something interesting: You can use a change set to add new and changed components, but you can't use change sets to delete or rename components.
- To delete components, use the web interface in the target org.
- To rename a component, first delete the component in the target org and then upload the new component in a change set.
Profiles and Permission Sets
Creating a change set of your own, including profiles and permission sets, requires special considerations. Review the documentation on deploying and retrieving profiles and permission sets before proceeding.
Upload the Change Set
Now that the connection is authorized, Calvin uploads his change set from his Developer sandbox to the Developer Pro sandbox.
- Log in to the org containing the outbound Change Set. For Calvin, this is his Developer sandbox.
- From Setup, enter Outbound Change Sets in the Quick Find box, then select Outbound Change Sets.
- Find the change set to upload. In this case, it is the change set Language Training.
- Click Upload and choose your target org. Calvin chooses the Developer Pro sandbox.
The outbound change set detail page displays a message, and you get an email notification when the upload to the target org is complete.
In the Developer Pro sandbox, Calvin and the org’s other admins have the opportunity to review what’s contained in the uploaded change set before deploying it.
Are We There Yet?
Calvin’s changes are in. Ella has made changes in her developer org and put them in a change set. They follow the same process to move the new change set to the Developer Pro sandbox.
- Authorize the deployment connection between the Ella’s Developer sandbox and the Developer Pro sandbox.
- Upload the change set from Ella’s sandbox to the Developer Pro sandbox.
Once both change sets are in the Developer Pro sandbox, the team can move on to the integration testing process.
Resources
- Data Modeling module
- Permission Sets and Profile Settings in Change Sets in Salesforce help