Start tracking your progress
Trailhead Home
Trailhead Home

Develop and Test Changes Locally

Learning Objectives

After completing this unit, you’ll be able to:
  • 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.
Note

Note

The customization we describe here is just an example of what you can do with the declarative tools that Salesforce provides.

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.

  1. After logging in to the sandbox, launch Setup.
  2. Click the Object Manager tab.
  3. Click Create | Custom Object in the top-right corner.
  4. For Label, enter Language Course. Notice that the Object Name and Record Name fields auto-fill.
  5. For Plural Label, enter Language Courses.
  6. Check the box for Launch New Custom Tab Wizard, then click Save.
  7. 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.

  1. From Setup, click the Object Manager tab.
  2. Click Create | Custom Object in the top-right corner.
  3. For Label, enter Language Course Designer. Notice that the Object Name and Record Name fields auto-fill.
  4. For Plural Label, enter Language Course Designers.
  5. Check the box for Launch New Custom Tab Wizard, then click Save.
  6. 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.

  1. From Setup, go to Object Manager | Language Course.
  2. Click Fields & Relationships. Notice that some fields are already there, including a name field.
  3. Click New in the top right corner.
  4. For data type, select Master-Detail Relationship.
  5. Click Next.
  6. Select Language Course Designer from the Related To menu and click Next.
  7. Fill out the following.
    • Field Label: Language Course Designer
    • Description: The author of this language course.
  8. 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.

  1. From Setup, enter Outbound Change Sets in the Quick Find box, then select Outbound Change Sets.
  2. Click New.
  3. Enter a name for your change set and click Save. Calvin names the change set Language Training.
  4. In the Change Set Components section, click Add.
  5. 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 Class and Language Course Designer, and clicks Add to Change Set.
  6. Click View/Add Dependencies to see whether the components you’ve added to the change set are dependent on other customizations. Component Dependencies page, listing dependencies by name and what references them.
  7. 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.

Authorize a Deployment Connection

As a security measure, any org accepting a change set must authorize a connection to accept that change set. Calvin authorizes a deployment connection in the Developer Pro sandbox, allowing it to receive an inbound change set from his Developer sandbox.

  1. Log in to the org that you want to receive the inbound changes. For Calvin, this is Zephyrus’s shared Developer Pro sandbox.
  2. From Setup, enter Deployment Settings in the Quick Find box, then select Deployment Settings.
  3. Click Edit next to the org from which you want to receive outbound change sets. For Calvin, this is the Developer sandbox where he created the custom objects.
  4. Select Allow Inbound Changes and click Save.

Calvin has authorized a connection between his Developer sandbox and the shared Developer Pro sandbox used for integration. Once this connection is made, the Developer Pro sandbox accepts any change sets uploaded by Calvin’s Developer sandbox. Calvin can disable this connection in the Developer Pro sandbox if he chooses.

Upload the Change Set

Now that the connection is authorized, Calvin uploads his change set from his Developer sandbox to the Developer Pro sandbox.

  1. Log in to the org containing the outbound Change Set. For Calvin, this is his Developer sandbox.
  2. From Setup, enter Outbound Change Sets in the Quick Find box, then select Outbound Change Sets.
  3. Find the change set to upload. In this case, it is the change set Language Training.
  4. 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.

Important

Important

You can’t modify the contents of a change set after you upload it to an org. If you want to modify a change set after you’ve uploaded it, clone the change set, modify the clone, and upload the modified clone to the target org.

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.

  1. Authorize the deployment connection between the Ella’s Developer sandbox and the Developer Pro sandbox.
  2. 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.

retargeting