Skip to main content Únase a nosotros en TDX, en San Francisco, o en Salesforce+ los días 5 y 6 de marzo en la conferencia para desarrolladores sobre la era de agentes de IA. Registrarse ahora.

#Trailhead Challenges2442 debatiendo

Hands-on challenges are the “secret sauce” of Trailhead. Before searching for solutions to superbadge challenges, review the Salesforce Certification Program Agreement and Policies.

Hi there,

I've been trying to finish the ¨Set Up Social Sign-On¨ step

but the error above is shown. Could anyone help me?

12 respuestas
  1. 25 oct 2023, 17:55

    Hi @Pedro Mendes and @Vivian Poon,

    try the below

    In  'Module3RegistrationHandler' Registration Handler Apex class ->to create a user your google account's firstname,lastname(surname) & email should not be null.

    Especially 'LastName' i.e. go to your Google Account->Personal Info->Name->Name->Edit->Surname.

    Try using 'Test-Only Initialization URL'  in browser and check if First name, last name and email are not null,as shown below

     

    <user>

    <full_name>User Name</full_name>

    <provider>Google</provider>

    <org_id>00D5g00000KLFs</org_id>

    <id>10430624005704332551</id>

    <portal_id>00000000000000</portal_id>

    <locale>en-GB</locale>

    <first_name>someName</first_name>

    <last_name>someName</last_name>

    <email>Gmail@gmail.com</email>

    </user>

     

    Try to check again after making changes, I hope you must be able to login using google now.

0/9000

Hello - 

 

Trying to complete the challenge where adding Google Social Sign-On to the Partners org.

 

I believe I've followed the steps, create the Provider, updated the Apex Class from the Git, added to page but when I go to login, receiving, "We can't log you in becasue of the following error. NO_ACCESS: Unable to find a user.

 

I've created a user with the gmail account I am trying to login with so not sure what else might be causing an issue.

 

https://trailhead.salesforce.com/content/learn/modules/identity_external/identity_external_social?trailmix_creator_id=strailhead&trailmix_slug=prepare-for-your-salesforce-advanced-administrator-credential

0/9000
0/9000

Hello Everyone, I am trying to complete my  DevWinter25 certification. I am facing an issue. I have completed the challenge in the Developer console, and it showed both strings as outputs( "Hello" ," World"). I am still getting prompt message saying that " We can't find the debug log with the string ‘Hello’.

 

 

I have tried multiple times by re-lauching the org, try doing again as new class, Run new test. I am still unsucessful. Is there anyone else facing this issue? Please, share if there is way to resolve this issue. please. Waiting to hear from you soon!

 

#Trailhead Challenges  #Certifications

4 respuestas
  1. 15 ene, 19:10

    Hi, @Kim Pat

     

    Try to use this code:

    Apex Class:

    public class MyIterable implements Iterable<String> {

    Private List<String> strings;

    // Constructor to initilize the list of strings

    public MyIterable(List<String> strings)

    {

    this.strings = strings;

    }

    // Implementing the iterator method

    public Iterator<String> iterator(){

    return strings.iterator();

    }

    }

    Test Class:

    @IsTest

    public class MyIterableTest {

    @IsTest

    static void testIterableForLoop(){

    // Create a list of strings

    List<String> strings = new List<String> {'Hello', 'World'};

    // Create an Instance of MyIterable

    MyIterable myIterable = new MyIterable(strings);

    // Use a for loop to iterate over the MyIterable instance

    for(String str: myIterable)

    {

    //Print each string to the debug log

    System.debug(str);

    }

    }

    }

    after saving Apex Class and Test Class click "Run Test".Hi, Try to use this code:Apex Class:public class MyIterable implements Iterable<String> { Private List<String> strings; // Constructor to initilize the list of strings public MyIterable(List<String> s

    Sincerely, 

    Mykhailo Vdovychenko 

    Bringing Cloud Excellence with IBVCLOUD OÜ

0/9000
Challenge Description:

 

Use DML to insert multiple records into a Salesforce database

 

Acme Inc. has opened three new locations in Texas. Acme needs to insert the new accounts into its database. Create a class and one method that creates three new accounts and adds them to the database.

  • Create a public Apex class named AccountHandler
  • Add a public static method to the class:

    • Name: insertAccount
  • Include a parameter for the number of new accounts:

    • Data type: integer
  • Create a list of Account records:

    • List name: addAccounts
  • Use a while loop to add three new Accounts to the list, where n is a value that is incremented by 1 during each iteration of the loop:

    • Name: Acme Inc n
    • AccountNumber: A000n
  • Hint: You did something like this when you created three new Tea Factory stores.
  • Write one DML statement that inserts all three records into the database at one time
  • Run your insertAccount method.

 

Error Message:

 

We can't find code that creates an 'addAccounts' list, adds three accounts to the 'addAccounts' list, and then inserts the 'addAccounts' list.

 

Code:

 

 

public class AccountHandler {

public static void insertAccount(Integer numAccts) {

List<Account> addAccounts = new List<Account>();

Integer counter = 1;

while(counter <= 3) {

Account a = new Account();

a.Name = 'Acme Inc ' + counter;

a.AccountNumber = 'A000' + counter;

addAccounts.add(a);

counter++;

}

if(addAccounts.size() > 0) {

Database.insert(addAccounts);

}

}

}

What am I doing wrong?

 

 
35 respuestas
  1. 13 ago 2019, 18:56
    This worked for me. 

     

    public class AccountHandler {

     

        public static void insertAccount(Integer numberofAccounts){

     

            Integer n = 1;

     

            List<Account> addAccounts=new List<Account>();

     

            while(n <= numberofAccounts){

     

                

     

              

     

                Account tempaccount=new Account();

     

                tempaccount.Name='Acme Inc '+ n;

     

                tempaccount.AccountNumber='A000'+ n;

     

                addAccounts.add(tempaccount);

     

                

     

                n=n+1;

     

            }

     

            insert addAccounts;

     

            

     

        }

     

    }
0/9000

When copying the AccountWrapperTests code, getting compilation error for TestFactory 

 

#Trailhead Challenges

3 respuestas
  1. 10 feb, 4:47

    Hello @Nishkam Agrawal

    TestFactory is a custom class which was created into this step - 

    https://trailhead.salesforce.com/content/learn/modules/unit-testing-on-the-lightning-platform/generate-data-for-tests

    Or just follow this Solution - 

    1. Create a Apex class TestFactory

    2. Copy this code 

    @isTest

    public class TestFactory {

    public static Account getAccount(String name, Boolean doInsert){

    Account a = new Account(name = name);

    if(doInsert){

    insert a;

    }

    return a;

    }

    public static Contact getContact(Id accountId, String fname, String lname, Boolean doInsert){

    Contact c = new Contact(firstName = fname, lastName = lname, accountId = accountId);

    if(doInsert){

    insert c;

    }

    return c;

    }

    public static void generateAccountWithContacts(Integer numContacts){

    Account a = getAccount('default account ltd', true);

    List<Contact> contacts = new List<Contact>();

    for(Integer i = 0; i < numContacts; i++){

    String contactName = 'contact' + i;

    contacts.add(getContact(a.id, contactName, contactName, false));

    }

    insert contacts;

    }

    public static Opportunity[] generateOppsForAccount(id accountId, Decimal amount, Integer numOpps){

    List<Opportunity> opps = new List<Opportunity>();

    for(Integer i = 0; i < numOpps; i++){

    Opportunity o = new Opportunity();

    o.name = 'Account ' + i;

    o.accountId = accountid;

    o.amount = amount;

    o.closeDate = Date.today().addDays(5);

    o.stageName = 'Prospecting';

    opps.add(o);

    }

    return opps;

    }

    public static User generateUser(String profileName){

    UserRole userRole = new UserRole(DeveloperName = 'TestingTeam', Name = 'Testing Team');

    insert userRole;

    User u = new User(

    ProfileId = [SELECT Id FROM Profile WHERE Name = :profileName].Id,

    LastName = 'last',

    Email = 'Cpt.Awesome@awesomesauce.com',

    Username = 'Cpt.Awesome@awesomesauce.com',

    CompanyName = 'Testing Co',

    Title = 'Captian',

    Alias = 'alias',

    TimeZoneSidKey = 'America/Los_Angeles',

    EmailEncodingKey = 'UTF-8',

    LanguageLocaleKey = 'en_US',

    LocaleSidKey = 'en_US',

    UserRoleId = userRole.Id

    );

    insert u;

    return u;

    }

    }

     

    https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007T46SOSAZ

0/9000
5 respuestas
  1. 18 dic 2023, 3:30

    Hi ,

     

    Try it on your new playground.

     

    Click this button to delete and create records using Apex code. If you can read Apex code, I think you can deal with this by modifying the code.

     

    global with sharing class DreamHouseSampleDataController {

    @RemoteAction

    global static void deleteAll() {

    DELETE [SELECT ID FROM favorite__c];

    DELETE [SELECT ID FROM property__c];

    DELETE [SELECT ID FROM broker__c];

    DELETE [SELECT ID FROM bot_command__c];

    }

    }

    https://trailhead.salesforce.com/trailblazer-community/feed/0D54V00007Rd3DRSAZ

0/9000

When I try to compete the Agent Action Configuration in Agent Builder, I get an error message that the API is already in use.  Any ideas what this means and how to fix it? 

 

#Trailhead Challenges

5 respuestas
  1. 30 ene, 12:15

    hi @Chris Wood

    Its beacuse you already have an action with the same apex class, if you created new Apex class then change the InvoacableMethod label name.

0/9000

I am not able to complete my maintenance certification of the challenge relating to "Get Hands-On with an Iterable Variable in For Loops ". As I tried completing the challenge trail with following the instructions, I am receiving following error.

The constructor MyIterable should accept parameter of type List<String>

The output in the test run I am getting the proper result. It looks like there is an issue with the playground itself. 

Is anybody else facing the same issue?

 

#Trailhead Challenges  #Trailhead-challenges

10 comentarios
  1. 6 ene, 19:05

    Hi, @Rakesh kumar

     

    Can you provide code of your Apex Class?

     

    Also too, if you believe the issue is with the Playground itself, try creating a new Playground and completing this Challenge there. 

     

    Sincerely, 

    Mykhailo Vdovychenko 

    Bringing Cloud Excellence with IBVCLOUD OÜ

0/9000

I just started Apex Basics and Database Trail 

Get Started with Apex - In which there is a Hands-on Challenge but in that module they didn't taught me how to write a code. So, how am i supposed to pass that challenge if I don't know how to write a code. 

Please help me. 

Thanks. 

 

#Trailhead Challenges

2 respuestas
  1. 25 ene, 4:53

    Hello @Rahul Jindal

    I understand your point and believe me Salesforce gives us many different ways to learn and improve every day. I am still learning and teaching after 6 years 😊. 

    Before you start writing code, read carefully the requirements of the practical challenge. Go through it until Identify what class or method you should create and what you are expected to do. For example: 

     

    Create a class called HelloWorld. 

    Define a method that returns “Hello, World!”. 

     

    In trailhead it explains to you that Apex has a similar structure to other object-oriented programming languages such as Java. For example:

    public class HelloWorld {

    public static String sayHello() {

    return 'Hello, World!';

    }

    }

     

     

    I would recommend that you continue practicing with the exercises and read the official documentation:

0/9000