Skip to main content Join us at TDX in San Francisco or on Salesforce+ on March 5-6 for the Developer Conference for the AI Agent Era. Register now.

#Trailhead Challenges2,360 discussing

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 All,I have created a developer account and created a demo  of Connected Apps. I enabled the OAuth and now I am trying to get the access token by using client the id and client secret and i am getting the following error{    "error": "invalid_client_id",    "error_description": "client identifier invalid"}

6 answers
  1. May 3, 2024, 5:19 AM

    solution : use domain-url as loginUrl instead of test.salesforce.com 

     

    i asked my client to update api implementation on their side, there was no other alternative.

    but some integrations still fail with above soln. e.g. IDE's

0/9000

Apex Web Services Superbadge Unit: 

Challenge: Find the Permissible Fly Zone 

Connected Org:  ravi.inboundkharkwal@gmail.com

Error Says: We can't find the expected permissible fly zone for a product for when the CountryCode is not included in the request headers.

 

However code is working for BOTH Header CountryCode & no Header CountryCode  Using Postman. Test Coverage is also 100%. 

 

#Integration

 

#Trailhead Challenges #Salesforce Developer

0/9000

Iam getting this above error message in our Einstein bot which works with article answers. Earlier it was working fine. But all of a sudden, we started receiving this error and the bot is moving to the confused stage instead of fetching article from knowledge base. We had connected with the support but still it's not solved. We are not able to identify the issue. Any valuable suggestion is appreciated.

Thanks in advance.

0/9000

I'm trying to complete the Apex Integration > Apex Web Services Challenge and getting the following error:

Executing the method 'getAccount' from the Apex class 'AccountManager' 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.

 

I verified the easy ones - the class is set to global, the url mapping is correct, and the class names are correct.  Also, when I run it via the Workbench Rest Explorer, I get back data from the class, so I know the class works the way I expect it to, so I have to assume the issue is in my test case.

 

Here's the code I'm using

@RestResource(urlMapping='/Account/*/contacts')

global class AccountManager {

@HttpGet

global static Account getAccount() {

RestRequest request = RestContext.request;

// grab the caseId from the end of the URL

String accountId = request.requestURI.substring(

request.requestURI.lastIndexOf('/Account/')+9,

request.requestURI.lastIndexOf('/'));

System.debug('accountId = ' + accountId);

Account account = [SELECT Id,NAME,(SELECT Id,NAME FROM CONTACTS) FROM ACCOUNT WHERE ID = :accountId];

System.debug(account);

return account;

}

}

@isTest

public class AccountManagerTest {

@isTest

static void testGetAccount() {

Id recordId = createTestRecord();

System.debug('Id = ' + recordId);

// Set up a test request

RestRequest request = new RestRequest();

request.requestUri = 'https://resilient-otter-s03cy5-dev-ed.trailblaze.my.salesforce.com/services/apexrest/Account/' + recordId + '/contacts';

request.httpMethod = 'GET';

RestContext.request = request;

// Call the method to test

Account thisAccount = AccountManager.getAccount();

// Verify results

System.assert(thisAccount != null);

}

// Helper method

static Id createTestRecord() {

// Create test record

Account accountTest = new Account(

Name='Test Account');

insert accountTest;

Contact contactTest = new Contact(FirstName='Test Account',LastName='Test Contact',AccountId=accountTest.Id);

insert contactTest;

return accountTest.Id;

}

}

I can't figure out what I've done wrong here.  Any advice would be appreciated.

1 answer
  1. Jul 17, 2023, 6:37 PM

    I was able to figure out what I had done wrong.

     

    The requirements called for the word Accounts in the URI for the resource.  I was only using the word Account.

     

    Once I corrected that, I was able to get the system to recognize the resource and run correctly.

0/9000