+ Start a Discussion
Pablo Ledesma 8Pablo Ledesma 8 
I have been trying to pass this challenge (https://trailhead.salesforce.com/en/trails/force_com_dev_intermediate/modules/apex_integration_services/units/apex_integration_webservices):

To pass this challenge, create an Apex REST class that is accessible at '/Accounts/<Account_ID>/contacts'. The service will return the account's ID and Name plus the ID and Name of all contacts associated with the account. Write unit tests that achieve 100% code coverage for the class and run your Apex tests.
The Apex class must be called 'AccountManager'.
The Apex class must have a method called 'getAccount' that is annotated with @HttpGet
The method must return the ID and Name for the requested record and all associated contacts with their ID and Name.
The unit tests must be in a separate Apex class called 'AccountManagerTest'.
The unit tests must cover all lines of code included in the AccountManager class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

I getting this error:

Challenge Not yet complete... here's what's wrong: 
Executing the 'AccountManager' method failed. Either the service isn't configured with the correct urlMapping, is not global, does not have the proper method name or does not return the requested account and all of its contacts.

This is my code:
global with sharing class AccountManager {
    global static List<sObject> getAccount(){
        RestRequest request = RestContext.request;
        List<String> urlParams = request.requestURI.split('/');
        String accountId;	
        for(String param: urlParams){
            if((param != 'Accounts') && (param != 'contacts'))
                accountId = param;
        List<Account> lstAccounts = new List<Account>();
        lstAccounts = [SELECT Id, Name FROM Account WHERE Id = :accountId];
        List<sObject> result = new List<sObject>();
        List<Contact> lstContacts = [SELECT Id, Name FROM Contact WHERE AccountId = :accountId];
        for(Contact c:lstContacts){
        return result;

This is my response
[ {
  "attributes" : {
    "type" : "Account",
    "url" : "/services/data/v39.0/sobjects/Account/001o0000015hgVBAAY"
  "Id" : "001o0000015hgVBAAY",
  "Name" : "SFDC Computing"
}, {
  "attributes" : {
    "type" : "Contact",
    "url" : "/services/data/v39.0/sobjects/Contact/003o000001DbYc8AAF"
  "Id" : "003o000001DbYc8AAF",
  "Name" : "Pepito Peres"
}, {
  "attributes" : {
    "type" : "Contact",
    "url" : "/services/data/v39.0/sobjects/Contact/003o000001BsUPwAAN"
  "Id" : "003o000001BsUPwAAN",
  "Name" : "Last0"
} ]

Can someone light my way?​
Best Answer chosen by Pablo Ledesma 8
Sandeep WaliaSandeep Walia
Hi Pablo,

The requirement for the challenge is to return Account and its related contacts, which can be achieved using one SOQL query. I am sharing the code for my apex class that successfully passed the challenge.
//Apex Class

global with sharing class AccountManager{
    global static Account getAccount(){
        RestRequest request = RestContext.request;
        String accountId = request.requestURI.substringBetween('Accounts/','/contacts');
        Account objAccount = [SELECT Id,Name,(SELECT Id,Name FROM Contacts) FROM Account WHERE Id = :accountId LIMIT 1];
        return objAccount;

//Test  class
private class AccountManagerTest{
    static testMethod void testMethod1(){
        Account objAccount = new Account(Name = 'test Account');
        insert objAccount;
        Contact objContact = new Contact(LastName = 'test Contact',
                                         AccountId = objAccount.Id);
        insert objContact;
        Id recordId = objAccount.Id;
        RestRequest request = new RestRequest();
        request.requestUri =
            + recordId +'/contacts';
        request.httpMethod = 'GET';
        RestContext.request = request;
        // Call the method to test
        Account thisAccount = AccountManager.getAccount();
        // Verify results
        System.assert(thisAccount!= null);
        System.assertEquals('test Account', thisAccount.Name);

While your code did provide the evrything that was required the JSON returned in the case of single SOQL  is different as compared to your JSON.

Hope this helps,
Suresh MeghnathiSuresh Meghnathi 
How can we display thousands of records on the VF page without using the StandardSetController or Pagination?
Best Answer chosen by Suresh Meghnathi
Ajay K DubediAjay K Dubedi
Hi Suresh,

If your purpose is to display the records only, then you can set the readOnly='true' in apex:page tag. Using this, the SOQL limit will be relaxed from 50000 to 100000.

I hope you find the above solution helpful. If it does, please mark as Best Answer to help others too.
Ajay Dubedi
Rohit TripathiRohit Tripathi 

This is the trailhead questions which I am trying to solve :

Create an Apex class that returns an array (or list) of formatted strings ('Test 0', 'Test 1', ...). The length of the array is determined by an integer parameter.The Apex class must be called 'StringArrayTest' and be in the public scope.
The Apex class must have a public static method called 'generateStringArray'.
The 'generateStringArray' method must return an array (or list) of strings. Each string must have a value in the format 'Test n' where n is the index of the current string in the array. The number of returned strings is specified by the integer parameter to the 'generateStringArray' method.

Here is my code :

public class StringArrayTest {
    public static List <String> generateStringArray (Integer n) {
       List<String> List1 = new List<String> ();
        for(Integer i=0;i<n;i++) {
          List1.add('\'Test'+ i+'\'' );
        return List1;


I am getting following error :

Challenge not yet complete... here's what's wrong: 
Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.

I tried it many times but I am not able to solve this problem. Please help. 

Best Answer chosen by Rohit Tripathi
I hope this is your final code,
public class StringArrayTest
    public static List<String> generateStringArray(Integer n)
        List<String> List1 = new List<String>();
        for(Integer i =0; i < n; ++i)
            List1.add('Test ' + i);
        return List1;
You may try to copy and past the above to overwrite your existing code.
Aliaksandr SatskouAliaksandr Satskou 

Please, help to set up proxy for SFDX CLI.

I'm trying:
sfdx update

I'm getting:
If you are behind a proxy, please make sure that the network 'proxy' config is set properly.  See: 'npm help config'

Regards, Aliaksandr Satskou
Best Answer chosen by Aliaksandr Satskou
Shunsuke Gimba (銀羽 俊介)Shunsuke Gimba (銀羽 俊介)
  internet options > lan settings > bypass proxy server for local addresses
on, because the login process seems to pass localhost(1717),
and this page should not be via proxy.
Then type command
  set https_proxy=[your proxy adress]
then you can login to DevHub using OAuth.

i hope this helps you.

I am currently trying to complete the trailhead 'Create a Hello World Lightning Web Component' section where you deploy the lightning web component from VSCode to your org, and im hitting the below error.

Starting SFDX: Deploy Source to Org

18:12:03.382 sfdx force:source:deploy --sourcepath c:\Users\ravent\Documents\SFDX Projects\HelloWorldLightningWebComponent\force-app\main\default --json --loglevel fatal
18:12:07.153 sfdx force:source:deploy --sourcepath c:\Users\ravent\Documents\SFDX Projects\HelloWorldLightningWebComponent\force-app\main\default --json --loglevel fatal ended with exit code 1



helloWorld error

As far as i can see i have followed the instructions to the letter, and cant seem to correct the error.

Any suggestions would be greatly appreachiated.

Best Answer chosen by raSFUser

worked it out, for anyone else seing this issue run the below command in CLI:

sfdx force:config:set apiVersion=45.0 --global

Also make sure that your project json is set:


  "packageDirectories": [
      "path": "force-app",
      "default": true
  "namespace": "",
  "sfdcLoginUrl": "https://login.salesforce.com",
  "sourceApiVersion": "45.0"

And that the example helloWorld xml api element provided also matches:

<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="helloWorld">

Atheer BdaiwiAtheer Bdaiwi 

We have a user that can't see a VF component for LinkedIn Sales Navigator (managed package).

All they see is the below:

User-added image

But, they need to have the below view:

User-added image
This is a VF component.

I have checked:

- Page Layout
- Profile
- LWC visibility 
- License (they have one)

Any ideas at all?
Best Answer chosen by Atheer Bdaiwi
Atheer BdaiwiAtheer Bdaiwi
User-added image

Answer above from LinkedIn support. 
Add Your Branding to Embedded Chat" Trailhead Challenge
I am trying to complete the challenge above posted here https://trailhead.salesforce.com/content/learn/modules/web-chat/web_chat_branding but have not been successful in loading the Chat Box when I open the VF page named "Web Chat" as stated in this challenge. Can someone please suggest why the chat pop up is not working? See the screenshot below. I have made sure that the agent is Active.

User-added image
Best Answer chosen by NamanB
ANUTEJANUTEJ (Salesforce Developers) 

For all the Certification and Trailhead Guidance please report it here,



So that our trailhead support engineers will look into it and get back to you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future.

Salesforce Support.
Best Answer chosen by Megha Sachania
SwethaSwetha (Salesforce Developers) 
HI Megha,
The runapex() would only function in the softphone and not when opened in a VF page. Can you confirm you have added your code to the softphone(After you create the HTML page, have you added the URL to the call center definition file)?

See https://developer.salesforce.com/docs/atlas.en-us.api_cti.meta/api_cti/sforce_api_cti_sample_js.htm for more information on how HTML Page in a Lightning Experience App would look like when added to call center definition file (https://developer.salesforce.com/docs/atlas.en-us.api_cti.meta/api_cti/sforce_api_cti_call_def_file.htm).

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Hi all,

I'm stuck in the Apex Integration Services - Apex SOAP Callouts challenge with the following message "The Apex class 'ParkLocator' does not appear to be calling the SOAP endpoint.".

Could you please advise ?
Best Answer chosen by EmilienGuichard
Jeff DouglasJeff Douglas
Try changing line #3 in ParkLocator to: 
ParkService.ParksImplPort park = new ParkService.ParksImplPort();
Sorry... it's case sensitive.  :(

If you had entered ParkService originally it would have generated this code in this manner. Not sure if it didn't overwrite these classes or something.

Jeff Douglas
Trailhead Developer Advocate
Ryan Adams 173Ryan Adams 173 
Please help me resolve this challenge:


The Challenge is as follows:

Generate an Apex class using WSDL2Apex and write a test class.
Generate an Apex class using WSDL2Apex for a SOAP web service, write unit tests that achieve 100% code coverage for the class using a mock response, and run your Apex tests.

Use WSDL2Apex to generate a class called 'ParkService' in public scope using this WSDL file. After you click the 'Parse WSDL' button don't forget to change the name of the Apex Class Name from 'parksServices' to 'ParkService'.
Create a class called 'ParkLocator' that has a 'country' method that uses the 'ParkService' class and returns an array of available park names for a particular country passed to the web service. Possible country names that can be passed to the web service include Germany, India, Japan and United States.
Create a test class named ParkLocatorTest that uses a mock class called ParkServiceMock to mock the callout response.
The unit tests must cover all lines of code included in the ParkLocator class, resulting in 100% code coverage.
Run your test class at least once (via 'Run All' tests the Developer Console) before attempting to verify this challenge.

The error I receive when checking the challencge is:

Challenge Not yet complete... here's what's wrong:
Executing the 'country' method on 'ParkLocator' failed. Make sure the method exists with the name 'country', is public and static, accepts a String and returns an array of Strings from the web service.

Here is the code I am using:
public class ParkLocator {
    public static String[] country(String ctry) {
        ParkService.ParksImplPort prk = 
            new ParkService.ParksImplPort();
        return prk.byCountry(ctry);

global class ParkServiceMock implements WebServiceMock {
   global void doInvoke(
           Object stub,
           Object request,
           Map<String, Object> response,
           String endpoint,
           String soapAction,
           String requestName,
           String responseNS,
           String responseName,
           String responseType) {
        // start - specify the response you want to send
        ParkService.byCountryResponse response_x = 
            new ParkService.byCountryResponse();
        List<String> myStrings = new List<String> {'Park1','Park2','Park3'};
        response_x.return_x = myStrings;
        // end
        response.put('response_x', response_x); 

private class ParkLocatorTest  {
    @isTest static void testCallout() {              
        // This causes a fake response to be generated
        Test.setMock(WebServiceMock.class, new ParkServiceMock());
        // Call the method that invokes a callout
        List<String> result = new List<String>();
        List<String> expectedvalue = new List<String>{'Park1','Park2','Park3'};
        result = ParkLocator.country('India');
        // Verify that a fake result is returned
        System.assertEquals(expectedvalue, result); 

Any help which can be provided is greatly appreciated.  If you could advise me at raadams173@gmail.com if you reply with a solution, I can log in to check it.


Best Answer chosen by Ryan Adams 173
Amit Singh 1Amit Singh 1
Hello Ryan,

Use below code for ParkLocator class.
public class ParkLocator {
    public static String[] country(String country){
        ParkService.ParksImplPort parks = new ParkService.ParksImplPort();
        String[] parksname = parks.byCountry(country);
        return parksname;
If this not resolves the problem then use a new Developer Org for completing the Challenge.

Let me know if this helps :)