Skip to main content
+3,500 points
Superbadge

Platform Events Superbadge Unit

Publish and subscribe to events for real-time data and event-driven automation.

~3 hrs

Platform Events Superbadge Unit

What You'll Be Doing to Earn This Superbadge

  1. Adjust a flow to subscribe to Platform Event messages.
  2. Subscribe to Platform Event notifications with an Apex trigger.
  3. Listen to event messages with a Lightning web component.

Concepts Tested in This Superbadge

  • Platform Events

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: Write down your username, password, and login URL for easy access later.

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

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, please review Salesforce Inbound Integration Specialist Superbadge: Trailhead Challenge Help.

If you’ve completed any of the superbadge units in the Salesforce Inbound 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 Salesforce Inbound Integration Specialist Superbadge. Complete the capstone assessment and related superbadge units to receive the Salesforce Inbound 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.
  • We recommend following best practices and always including descriptions for configurations. However, we’re not checking for descriptions in this superbadge unit.

Use Case

Aero Technica Solutions has expanded its offerings with a new service platform where clients can post available drone operating jobs, referred to as “missions.” The company maintains a network of drone pilots who can select and complete these missions. Once the details of a mission are finalized, it's submitted for pilot consideration.

You're tasked with enhancing the mission management process so that clients can easily submit these jobs and drone operators can view and accept them. Clients can judge whether to accept a pilot based on their rating in the system, and you will work to make sure those ratings stay accurate. Finally, each registered pilot has one or more drones linked as assets to their contact record. When pilots sell, lose, or otherwise need to disconnect all the related assets, you will need to develop a Lightning web component to send a toast notification that confirms that the assets were disconnected.

Business Requirements

Subscribe to Mission Allocation Events

As an integration developer, your focus is on enhancing the existing Submit Mission flow within the mission management system. A flow has already been set up that sets the mission status to 'Pending' once the user submits the mission via the Submit Mission button on the mission record. A resource variable named var_missionNumber is used to pass the mission number into the flow. Your task is to upgrade this flow to effectively manage the distribution of the missions to drone pilots who express interest.

Create an enhancement in the Submit Mission flow so that it automatically resumes when a Mission Allocation platform event is received. This is a crucial step for assigning missions to interested drone pilots. In your solution, the flow should initially pause after the status is set to 'Pending' and resume operation upon detecting the Mission Allocation event message.

This message provides essential details like Mission Number (API Name Mission_Number__c) and the ID of the drone pilot showing interest, Contact Id (API Name Contact_Id__c). Make sure the mission number in the event message is the same as the mission number that is passed into the flow. When the flow resumes, it should update the mission's status to Picked and assign the mission to the correct pilot by updating the Pilot (API Name Pilot__c) field with the received pilot ID.

Test this by running the flow for one of the mission records in the org. Publish a Mission Allocation event message using Apex code, Postman, or the Streaming Monitor tool (already installed in the org). Make sure that the flow resumes correctly and processes the mission number and pilot ID correctly so that the mission status and pilot assignment are updated. You will know you have been successful if the flow consistently resumes operation upon receiving the Mission Allocation event and accurately processes the provided information. Your enhancement should demonstrate the integration of event listening and flow resumption.

Subscribe to Standard Platform Events

Your next task is to streamline and supervise the operation of Aero Technical Solutions' drone pilot rating system. This system is an important part of how the company's clients decide which pilots to hire, and how its pilots can stay eligible for new assignments. It operates on a weighted rating principle, assessing pilots based on their mission completion rate and overall performance.

The PilotRatingBatch Apex batch job looks at completed missions to evaluate completion rates and safety incidents, and calculate an updated overall rating. This new rating is then added to the existing rate to reflect the pilot's current standing. But here’s the twist: The batch job responsible for these calculations is currently experiencing errors, and the company needs your expertise to log the error into a custom object. Adjust the PilotRatingBatch batch Apex class so that it can publish Standard Platform Event messages with details of errors or exceptions it encounters.

Note

Note

Our goal here is to make sure all existing errors are caught, so please don't correct the error. Also, there are some existing mission records in the org that you can leverage, or you can create your own that match the criteria.

Then, develop an Apex trigger to capture any errors during the PilotRatingBatch job's execution. This trigger should be on the lookout for any issue, big or small, in the processing of pilot ratings. Store them in a custom object named Error Log. Make sure the Apex job ID is recorded in the Async Apex Job Id (API Name Async_Apex_Job_Id__c) field. This log will act as the central point for monitoring and addressing issues in the pilot rating process.

Test this by running the PilotRatingBatch Apex class and checking to see if the errors are being correctly logged in the Error Log. Also, build unit tests for the Apex trigger to achieve at least 90% code coverage. This is your assurance that the solution is robust and reliable.

Subscribe to Asset Disconnection Events

Your next task involves enhancing the user experience for Aero Technica Solutions' client-facing staff. Your focus will be on the disconnectionNotice Lightning web component on the Contact record page. This component is necessary to indicate the successful disconnection of related assets, such as drones, from a pilot's account. This operation is particularly important when drones are lost, sold, or require disconnection for security reasons. This activity supports the company’s focus on providing optimized drone services and ensures a smooth operational flow, particularly in asset management scenarios.

The Disconnect All button on a contact record initiates the disconnection of related assets. This button launches a flow named Disconnect Assets that invokes an Apex class named DisconnectRelatedAssets. This class updates the status of related assets to Disconnected and publishes an event message detailing the disconnection operation.

Modify the disconnectionNotice Lightning web component to efficiently handle Asset Disconnection event messages. These messages contain vital information like the Asset Identifier (API Name Asset_Identifier__c) and the disconnection status, Disconnected (API Name Disconnected__c, a Boolean indicating true or false).

In your Lightning web component, define a variable channelName to store the Asset Disconnection event channel name. Also, create a function expression named messageCallback to process the payload from the event message. Set the status variable to the Disconnected value from the payload. Execute the showSuccessToast method when Disconnected__c value is true and showErrorToast when Disconnected__c value is false.

It is best practice to unsubscribe to the platform event in the disconnectCallback() method, but we're not checking for it in this challenge.

Test this with a contact record by clicking the Disconnect All button. Ensure that the disconnectionNotice Lightning web component displays appropriate success or error messages for each disconnected asset. This ensures that your modification accurately reflects the disconnection status and accurately manages pilots' drone assets.

Ready to Tackle This Superbadge?

Please first complete the prerequisites and the challenge for Platform Events Superbadge Unit will be unlocked.

~3 hrs