• Tripti Lakhara
  • NEWBIE
  • 10 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
In Trailhead unit:
User Authentification > Secure Your User's Identity

Cannot find error to complte Challenge.

I completed the Challenge succeeding at all steps:
1. Setup> "Session Settings", "Two-Factor Authentification" is in "High Assurance" category listbox, saved.
2. Created new user with "Salesforce Platform License", Profile as "Standard Platform User":, Generated new password.
3. Created new permission "Trailhead", in "Session Permissions", edited to select "Two-Factor Authentification for User Logins", saved.
4. Went to "Manage Assignments", assigned permission set to new user's account, Add Assignment, clicked Assign.
5. Successfully connected Salesforce Authenticator Mobile App to the user account:
6. I logged out of Salesforce under my name and logged in with new user name, followed steps and succeeded to use 2 factor authentification with mobile to log into Salesforce. Numerous times.

Clicked on "Check challenge to earn 500 points" and receive error notice and get message:
"Could not find a user's successful login using two-factor authentication. Make sure you successfully login at least once and that you are prompted for a second factor of authentication."
 
I am facing issue to clear this challange 

AnimalLocator code:
public class AnimalLocator
{
  public static String getAnimalNameById (Integer id)
   {
        Http http = new Http();
        HttpRequest request = new HttpRequest();
        request.setEndpoint('https://th-apex-http-callout.herokuapp.com/animals/' + id);
        request.setMethod('GET');
        HttpResponse response = http.send(request);
          String strResp = '';
           system.debug('****response '+response.getStatusCode());
           system.debug('****response '+response.getBody());
        // If the request is successful, parse the JSON response.
        if (response.getStatusCode() == 200) 
        {
            // Deserializes the JSON string into collections of primitive data types.
           Map<String, Object> results = (Map<String, Object>) JSON.deserializeUntyped(response.getBody());
            // Cast the values in the 'animals' key as a list
           Map<string,object> animals = (map<string,object>) results.get('animal');
            System.debug('Received the following animals:' + animals );
            strResp = string.valueof(animals.get('name'));
            System.debug('strResp >>>>>>' + strResp );
        }
        return strResp ;
   }
}

test class AnimalLocatorTest:
@isTest
private class AnimalLocatorTest{
    @isTest static  void AnimalLocatorMock1() {
        Test.SetMock(HttpCallOutMock.class, new AnimalLocatorMock());
        string result=AnimalLocator.getAnimalNameById(3);
        string expectedResult='chicken';
        System.assertEquals(result, expectedResult);
    }
}
mockclass:
@isTest
global class AnimalLocatorMock implements HttpCalloutMock {
    global HTTPResponse respond(HTTPRequest request) {
         HttpResponse response = new HttpResponse();
        response.setHeader('Content-Type', 'application/json');
        response.setBody('{"animal":{"id":1,"name":"chicken","eats":"chicken food","says":"cluck cluck"}}');
        response.setStatusCode(200);
        return response;
    }
}
i have created
1.AnimalLocator User-added image



2.AnimalLocatorMock
User-added image

3.AnimalLocatorTest

User-added image


error i am getting

User-added image

please help me
Sales Managers have asked for an at-a-glance solution to see completeness on leads. Create a helper formula field that looks at 5 key fields on the Lead object and evaluates their completeness, then a second formula field that references the helper formula and returns an image.

>The helper formula field should be on the Lead object with a name of 'Lead Quality Helper' and a resulting API name of 'Lead_Quality_Helper__c'.
>The helper formula should be of type Number.
>The helper formula should evaluate the following 5 fields: Email, Phone, Company, Title, and Industry and return 0 if blank and 1 if not blank. >The formula should then add all the values together to return a total value.
>The image formula should be on the Lead object with a name of 'Lead Quality' and a resulting API name of 'Lead_Quality__c'.
>The image formula should reference the helper formula, and return an image based on the number returned by the helper formula. The helper formula should be of type Text. Note: All of these images are already available in your Developer Edition.

1 = /img/samples/stars_100.gif with alternate text '1 star'
2 = /img/samples/stars_200.gif with alternate text '2 stars'
3 = /img/samples/stars_300.gif with alternate text '3 stars'
4 = /img/samples/stars_400.gif with alternate text '4 stars'
5 = /img/samples/stars_500.gif with alternate text '5 stars'

If none of the fields are filled out, the default should be /img/samples/stars_000.gif with alternate text '0 stars'.
The 'Lead Quality' formula must be added to the Lead Layout page layout.

ok so im having trouble on this challenege on trailhead. im confused what it means by helper formula, like how would we create a helper formular? also how would we create a image formula?

thanks if anyone answers 
Hi ,

I have written a piece of trigger , trying to prevent duplicate contacts on an Account:

trigger PreventDuplicateContact on Contact (before insert, before update){

Set<id> accid = new Set<id>();
for (Contact c : Trigger.new)
accid.add(c.Accountid);

Map<Id,list<contact>> AccEmails = new Map<Id,list<contact>>();
Map<Id, Contact> cont = new Map<Id, Contact> ([Select Email from Contact where Id in:accid]);

for (Contact c : Trigger.new){
if ((contact.Email !=null) && (System.Trigger.isInsert ||(contact.Email != System.Trigger.oldMap.get(contact.Id).Email))){
if ( cont.containsKey(contact.Email)){
Contact co = cont.get(contact.Email);
if(co.accountid==contact.accountid){
contact.Email.addError('Another new contact has the '+'same email address.');
            }else{
                cont.put(contact.Email,c);
     }}
       }
    }
    for (Contact c : [SELECT Email FROM Contact WHERE Email IN :cont.KeySet()]){
        Contact newContact = cont.get(c.Email);
        newContact.Email.addError('A Contact with this email '+'address already exists.');
   }
}

But this is not working as expected. Please help me get it modified
  • September 01, 2014
  • Like
  • 0