Skip to main content Build the future with Agentforce at TDX in San Francisco or on Salesforce+ on March 5–6. Register now.
+3,000 points
Superbadge

External Services Superbadge Unit

Integrate and call external service methods from flows and Apex classes.

~2 hrs

External Services Superbadge Unit

What You'll Be Doing to Earn This Superbadge

  1. Register an external service for an API specification.
  2. Activate API operations.
  3. Configure a flow to invoke external services.
  4. Invoke the external service from an Apex class.

Concepts Tested in This Superbadge

  • Registration of External Services
  • Invoking External Services with Flows
  • Invoking External Services with Apex Classes

Prework and Notes

Sign Up for a Developer Edition Org with Special Configuration

To complete this superbadge unit, you need a special Developer Edition org that contains special configuration and sample data. Note that this Developer Edition org is designed to work with the challenges in this superbadge unit.

  1. Sign up for a free Developer Edition org with special configuration.

  2. Fill out the form. For Email address, enter an active email address.

  3. After you fill out the form, click Sign me up.
  4. When you receive the activation email (this might take a few minutes), open it and click Verify Account.

  5. Complete your registration by setting your password and challenge question. Tip: Save your username, password, and login URL in a secure place—such as a password manager—for easy access later.

  6. You are logged in to your superbadge Developer Edition org.

Additional Configuration

  1. Go to the homepage of the Balanced Living app.

  2. Click the Setup button within the Lightning web component provided.

  3. If this is the first time setting up, you will see a success message. If the credentials are already set, it will indicate that no further action is needed.

Now, connect your new Developer Edition org to Trailhead.

  1. Make sure you’re logged in to your Trailhead account.

  2. In the Challenge section at the bottom of this page, select Connect Org from the picklist.

  3. On the login screen, enter the username and password for the Developer Edition org you just set up.

  4. On the Allow Access? page, click Allow.

  5. On the Want to connect this org for hands-on challenges? page, click Yes! Save it. You are redirected back to the Challenge page and ready to use your new Developer Edition org to earn this superbadge.

  6. Now that you have a Salesforce org with special configuration for this superbadge unit, you’re good to go.


Note

Note

Before you begin the challenges, review Outbound Integration Specialist Superbadge: Trailhead Challenge Help.

If you’ve completed any of the superbadge units in the Outbound Integration Specialist Superbadge, you can use the Developer Edition org to complete the challenges in this superbadge unit. If not, make sure you’re using a new Developer Edition org from this signup link. If you use an org that’s been used for other work, you won’t pass the challenges in this superbadge unit.

This superbadge unit is part of the Outbound Integration Specialist Superbadge. Complete the capstone assessment and related superbadge units to receive the Outbound Integration Specialist Superbadge.

Review Superbadge Challenge Help for information about the Salesforce Certification Program and Superbadge Code of Conduct.

Tips

  • Enter all labels exactly as described in the instructions. Labels are case-sensitive and spelling counts.
  • When possible, copy and paste the label names from the instructions instead of typing them.
  • Build your solution according to the requirements; adding more configurations can cause challenge checks to fail.
  • Superbadge units focus on very specific objectives. Some best practices or typical approaches might not be required in the challenges, such as using the Update Records element to update the record field values with the response from the external service. These actions will not be required to pass the challenge unless specified.
  • We recommend following best practices and always including descriptions for configurations. However, we’re not checking for descriptions in this superbadge unit.
  • Use system logging to help diagnose issues during the development and testing phases.

Use Case

Welcome to Alignment Accounting, a company that is committed to the well-being of its employees. Alignment Accounting understands that the demands of a career in accounting can take a toll on both physical and mental health, and it actively seeks new ways to support its staff.

Balanced Living is Alignment Accounting’s latest initiative to promote a balanced lifestyle among its employees. This app provides personalized wellness activity suggestions based on daily inputs from employees about their physical and emotional states. From guided mindfulness exercises to stretching routines tailored for office settings, Balanced Living ensures that every suggestion is aligned with the user's current needs and preferences.

The company wants to promote and monitor usage data to ensure the new program is a worthwhile investment. As an integration specialist at Alignment Accounting, you will work to integrate the app with various internal and external systems, which will give the company access to regular reports on usage data. You will also set up processes to encourage employees to register for challenges in the app. Naturally, all of this must be done while adhering to strict security and privacy standards for the company and individual users.

Your work will help Alignment Accounting offer its employees a responsive and personalized wellness app, directly contributing to a healthier, more productive workplace. You will ensure employees have access to timely and appropriate wellness activities, and that the company can monitor usage and accurately determine its return on investment. Ready to get started?


Note

Note

This unit requires additional setup. Make sure to complete the additional configuration in the Prework and Notes section.

Business Requirements

Register the External Service

Alignment Accounting is launching the Balanced Living program to promote wellness and health among its employees by providing tailored wellness activity suggestions based on an external API. This API provides personalized activity suggestions based on user profiles and their specific wellness goals. A secure connection is established from Salesforce using named credentials to integrate this API.

The first task involves configuring Salesforce to connect securely with the BalancedLiving API using the provided API specifications. This requires the setup of an external service that knows how to communicate with the BalancedLiving API and handle data securely and efficiently.

Implement the connection setup of an external service called BalancedLiving in Salesforce using the provided API specifications. This includes configuring how Salesforce communicates with the BalancedLiving API to retrieve and send data securely. Configure the external service with the IntegrationSB__BalancedLiving named credential to authenticate API calls securely. This ensures that all data transmitted between Salesforce and the BalancedLiving API is encrypted and access is controlled.

Activate the following operations from the API specification.

  • GetJourneysByType
  • SubmitCompletion
  • EvaluateEngagement

Ensure the service accurately fetches the selected operations within the external service setup.

Get Wellness Journeys by Type

When Alignment Accounting introduced the Balanced Living app, its aim was not just to promote health and wellness but to integrate these principles into everyday work life. Employees are strongly encouraged to participate in the app’s various wellness journeys.

A Wellness Journey Selection screen flow on the Balanced Living app's homepage lets the users select the type of challenge journey they’d like to participate in for the week. Two types of journeys are available: Physical wellness and Mental wellness. The user’s selection is recorded in the Fitness_Journey_Type list in the Journey Selection screen element.

Update the flow to invoke the GetJourneysByType action after the Journey Selection screen by passing the user’s selection as the URI parameter, Journey Type. The external service then returns personalized suggestions for journeys as a list of BalancedLiving_Journey data type. The flow should accurately retrieve and display a list of journeys based on the user's selection.

Create a flow resource to store the result of the invoked action and then present the name of the journeys (BalancedLiving_Journey records) as choices in the Select_Journey screen element. The external service returns journeys with unique names. The user should be able to select one journey out of the suggested options. After the user selects the name of the journey, the flow should proceed to the next screen where the rest of the details of the selected journey should be displayed.

Tip

Tip

The USF Collection Processor managed package is already installed in the special org for this superbadge unit. Use a Collection Filter element with a Loop element or the Get First action from the managed package to store the details of the selected journey in the varSelectedWellnessJourney variable resource.

Use the varSelectedWellnessJourney variable resource to store and display details of the selected journey. Then, update the display text component in the Selected_Journey screen element to show the details of the selected journey.

Use the following mapping of fields to store the details.

Field Value
Name (Name) name
Description (Description__c) description
Completion Goal (Completion_Goal__c) goal
Is Accessible (Is_Accessible__c) accessible
Metric Type (Metric_Type__c) metricx2dtype
Points (Points__c) points
Type (Type__c) z0type

Finally, set the completion date (API Name Wellness_Journey__c.Completion_Date__c) to any date in the future and status (API Name Wellness_Journey__c.Status__c) as In Progress (but we won't check for this in the challenge).

Submit Wellness Journey Completion

Alignment Accounting is focused on recognizing employees for their participation in wellness journeys. This challenge involves capturing the completion of a wellness journey by a user, submitting this information to an external service, and receiving a score or points based on the completion details.

Users should use the Wellness Journey Touchpoint screen flow on the homepage to select the journey they’d like to mark complete and claim points for. The flow already lists the In Progress journey records and stores details of the selected journey in a record variable varSelectedJourneyRecord.

The flow is also set up to accept the Completion Value for a selected journey in the Journey Details screen. Your task is to configure the flow to call the SubmitCompletion action in the external service and retrieve points awarded for the activity.

First, create a resource variable to construct a JSON payload with details such as the journey name (name), type (z0type), points (points), completion goal (completionx2dtarget), completion value (completionx2dvalue), and whether it was completed (completed). Set the values for 'completion value' and 'completed' from the screen element components.

Tip

Tip

You can use values from the varSelectedJourneyRecord Wellness Journey record variable or the result in the outputMember of the Get_Selected_Journey action to construct the JSON payload.

Ensure that the JSON request body is constructed according to the API specification. Then, send this data to the external API using the SubmitCompletion action and ensure it is executed successfully, receiving the points in response.

Capture the points returned by the API and update the Points Earned field on the journey record. The flow should allow users to input their journey completion details and submit them to the external service to capture the points earned.

Evaluate Engagement

Alignment Accounting wants to use data-driven insights to monitor and enhance the effectiveness of its wellness program. By measuring how actively employees engage with the wellness program and app, the company can identify trends, pinpoint areas for improvement, and ultimately drive higher participation rates. This helps in tailoring the program to better meet employee needs.

A scheduled Apex class named ReportEngagementScheduler calculates the monthly engagement rate for wellness activities. It should make a callout to the EvaluateEngagement operation with this data. The engagement rate is calculated by determining the proportion of active participants in wellness activities relative to the total assumed number of employees (100). Once the engagement rate is calculated, it must be packaged and sent to the external service. This involves constructing a request that includes the engagement data and the relevant month. The request must be serialized appropriately for transmission over the network, adhering to the external service's expected data format.

Tip

Tip

Review the generated dynamic Apex classes BalancedLiving, BalancedLiving_EvaluateEngagement_IN_body, and BalancedLiving_EvaluateEngagement_OUT_200 in the org. Use system logging to help diagnose issues during the development and testing phases.

Update the reportEngagement method in the EmployeeFitWellUtilClass class to instantiate an instance of the BalancedLiving external service. Then construct a request body that includes the engagement data and the relevant month. The EvaluateEngagement method returns a response with a status and a recommendation. The status field indicates the engagement level, and the recommendation field provides actionable advice to maintain or improve the current status. Verify that the Apex class handles responses from the external service efficiently and creates an Engagement_Evaluation__c record only if the response indicates it is successful.

Ready to Tackle This Superbadge?

Please first complete the prerequisites and the challenge for External Services Superbadge Unit will be unlocked.

~2 hrs