Loading

Apex for Agentforce Superbadge: Trailhead Challenge Help

Introduction

This help article is designed to provide resources to complete the superbadge challenges. It also offers links to useful articles and details various troubleshooting techniques.

     

    About Superbadges

    Superbadges assess your understanding and ability to apply key concepts, tools, and methodologies in a hands-on practice environment. These technical assessments help bridge the gap between what you’ve learned and how you can apply those skills in real-world scenarios. Completing a superbadge shows your ability to work on Salesforce implementations, demonstrates your expertise, and can help with certification preparation.

     

    How Is a Superbadge Different From Modules and Projects on Trailhead?

    Modules introduce you to specific topics in bite-sized units, and projects give you hands-on practice via step-by-step instructions. Superbadges present the requirements in a narrative format with multiple hands-on challenges. Trailblazers need to complete the challenges by configuring a technical solution in a special Salesforce Developer Edition org. Read more about how the Salesforce Program Agreement applies to superbadges.

     

    General Notes

    Each superbadge includes recommended learning. Completing the recommended learning for each superbadge is the best way to prepare for the superbadge challenges. Many concepts tested in the superbadge are covered in the recommended learning.

    Make sure you’re using the org specified to complete the challenges. For this superbadge, Apex for Agentforce, please use this page to sign up for the special Developer Edition org with the configuration you need to pass the challenges.

    • Important Note: If Einstein is enabled in your org, you may still see an error message indicating that Einstein is not enabled. If this happens, please toggle Einstein off and then on again.

    Check out Superbadge Challenge Help article for more notes on completing superbadges.

     

    Accessibility Considerations for This Superbadge

    There are no specific accessibility notes for this superbadge at this time. If you encounter accessibility issues with the content, please use the resources provided via the "Question, feedback or help" widget on the superbadge page.

     

    Challenge Resources for Superbadge: Apex for Agentforce

    You may notice that test coverage for your Apex classes isn't assessed as part of this superbadge. That's because this superbadge focuses on providing an opportunity to practice using Apex in relation to Agentforce. However, in real implementation scenarios, ensuring thorough test coverage is an important part of any custom code development in Salesforce. For more information, see Testing and Code Coverage in the Apex Developer Guide.

    Tip: If you run into a "Configuration Issues Detected" popup while working on the superbadge challenges in Agentforce Builder, you should be able to click the Ignore & Activate button and continue on with your work.

    Resources for Completing Challenge 1: Get Ready for the Superbadge: Apex for Agentforce

    Tips:

    • If you try to add an action to a subagent from the Asset Library and encounter an infinite loading spinner or an error message beginning with "Failed to create local topic from POJO," the workaround is to refresh the page and then create the action directly from the agent using the Create New Action option instead of adding it from the Asset Library. 
      • For this superbadge, the two actions that may need to be added directly are Lookup Contact by Email and Lookup Experience (both have Reference Action Type = Flow)
        • When configuring the actions:
          • Keep the default Agent Action Label and Agent Action API Name
          • Keep the default Agent Action Instructions 
          • Uncheck the box for "Show loading text for this action"
          • Under "Input," check the "Require input" box
          • Under "Output," check the "Show in conversation" box
    • While creating the subagent in Legacy Builder, if you encounter a Topic Overlap Detected modal, click Ignore and move to the next step. 
    • After enabling Einstein, you may need to refresh the page before Agentforce can be enabled. 
    • Adding instructions to a subagent is important to set the guardrails for agent behavior, but isn't the main objective of this superbadge. 

    Additional Resources

     

    Resources for Completing Challenge 2: Create an Invocable Apex Class to Call an Existing Functionality

    Listed below are relevant fields with their API Name and Type used in this superbadge. You can have this open in a separate window for quick reference.

    Field Names: Guest Review (Custom Object) 
    Field LabelField NameData Type
    ContactContact__cMaster-Detail (Contact)
    ExperienceExperience__cMaster-Detail (Experience)
    RatingRating__cPicklist 
    CommentsComments__cLong Text Area


    The following code can be used to retrieve the details about the guest review submitted by the user in requests and insert a guest review record with Apex.

    Contact contact = requests[0].contact;
    Experience__c experience = requests[0].experience;
    String rating = requests[0].rating;
    String comments =  requests[0].review;
    Guest_Review__c guestReview = new Guest_Review__c(Contact__c = contact.Id, Experience__c= experience.Id, Rating__c = rating, Comments__c= comments);
    insert guestReview;
    
    

    Additional Resources

     

    Resources for Completing Challenge 3: Invoke a Prompt Template From an Apex Class

    Tip:

    • Complete the TO-DO tasks in the GuestReviewRatingCalculator class. Do not change the method definition by making it static. If you do, you may run into an error message that begins with "An unexpected error occurred and we couldn't check your work."

    Additional Resources

     

    Resources for Completing Challenge 4: Configure an Apex Action for an Agent

    Tip: While creating the Apex agent action, if you receive the message: "This page has an error ... [PromiseRejection:[object Object]]", refresh the page and try again.

    Additional Resources

    If you’d like to flex your skills, you can test your agent in the Coral Cloud Experience Site. While not part of the superbadge challenge, the following setup steps will allow you to test your agent setup in the coral-cloud site.

    1. Activate the Coral Cloud Experience Agent.
    2. Publish the ESA Web Deployment.
      1. In the Setup Quick Find, search for and select Embedded Service Deployments. Select ESA Web Deployment, and then Publish. Note: The deployment may take up to 10 minutes, but there's no need to wait; proceed to the next step.
    3. Activate Messaging: In the Setup Quick Find, search for and select Messaging Settings. Toggle Messaging to On. 
    4. Publish the Experience Cloud Site: In the Setup Quick Find, search for and select All Sites. Select Builder next to the coral-cloud site, and then Publish. (You may need to confirm after Publish.)
    5. Configure the Flow: Route to ESA.
      1. Within the flow, open the Route to ESA element.
      2. Update the Service Channel to Messaging.
      3. Update Route To field to Agentforce Service Agent.
      4. Select Coral Cloud Experience Agent as the Agentforce Service Agent.
      5. Click Save As New Version and Activate the flow. 
    6.  Add the Coral Cloud Experience Agent to the coral-cloud site.
      1. In the Setup Quick Find, search and select All Sites.
      2. Click Builder next to the coral-cloud site.
      3. Add the Embedded Messaging component anywhere in the site. Publish the new changes to the site. It may take a few seconds for the component to appear.
    7. Enable standard external profiles login.
      1. In Setup Quick Find, open Digital Experience | Settings.
      2. Select the checkbox Allow using standard external profiles for self-registration, user creation, and login, and then Save.
    8. Update Customer Community User Aarika Jaray
      1. Set the email for this user as aarikajaray@communityuserexample.com. It should match the email field on the user’s contact record.
    9. Test the Coral Cloud Experience Agent by logging in as customer community user Aarika Jaray.
      1. In the Coral Cloud app, select the contact record for Aarika Jaray, and select Log in to Experience as User from the Lightning Actions menu.  
      2. Click the Messaging icon to initiate a conversation with the agent.

     

    Need More Help? The Trailblazer Community Awaits!

    As a reminder, a superbadge is a great way for you to assess your skills and knowledge and work on your problem-solving abilities. You'll get the most value by working hard to figure things out on your own. However, if you get stuck, you're welcome to reach out to the Trailblazer community. You can also help fellow Trailblazers who are stuck in a challenge, just remember that your superbadge org and solutions should never be shared.

     

    Related Superbadges

    Here are some related superbadges that might be helpful.

     

     
    Chargement
    Salesforce Help | Article