+ Start a Discussion
Francois CombeauFrancois Combeau 
1) I used use Module3RegistrationHandler.cls as registration handler.
2) I selected Google as login capability for Partners ( cf screenshot below)
However, the challenge fails with the following message :
Challenge Not yet complete... here's what's wrong:  Could not find a login to your community using Google.
Anybody can help ?
Thanks :-)
"Login & Registration" page
Best Answer chosen by Francois Combeau
SandhyaSandhya (Salesforce Developers) 
Hi Francois Combeau,

Check if you can log into the community using Google sign on the login page.

And also please consider this point in the same trailhead unit.

From Setup, enter All Communities in the Quick Find box, then select All Communities and click Manage next to the Customers community.
Select Administration, then Login & Registration and you see that Google is now an option.

Select Google and click Save.
To confirm your change, return to your private (incognito) browser and reload the login page. Check that the Google icon appears on the login page.

Hope this helps you!

Please accept my solution as Best Answer if my reply was helpful. It will make it available for other as the proper solution.

Thanks and Regards
Sandhya

 
Rohit TripathiRohit Tripathi 
Hello,

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+'\'' );
  }
        System.debug(List1);
        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
akramakram
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.
Philip GulanPhilip Gulan 
Hello,

I have created an email tamplete which is available for use.
Then I have created an Email Alert with following values:
Description: Thank you
Unique Name: Thank_You_Eamil

in Process Builder I have selected "Eamil Alerts" and Thank_You_Eamil for Email Alert Field, but I get an Error message and the Email Alert cannot be recogonized.
any help is apperciated

User-added image,

User-added image
 
Best Answer chosen by Philip Gulan
surya kanadhipatlasurya kanadhipatla
Philip Gulan,
Please double check that email alert is created on same object you used in Process Builder. 

i.e if process Builder fires on Case object and alret is on Lead, process can't reconize the email alert.
citygirl403citygirl403 

how to do you copy activity history from one record to another.  I want activity history in both records.  I thought this could be done by upsert using the data loader.  When using data loader is moves the activity history to the new record. 

Best Answer chosen by Admin (Salesforce Developers) 
Steve MolisSteve Molis

Okay, if  your user is unwilling to simply enter the Activities for the new Opportunity, then your only choice is to extract the Activity records using the Force.com Data Loader.  Copy the Activity records that need to be cloned to the new Opportunity, and then re-parent them to the new Opportunity by inserting the new Opportunity Id into the WhatId field on the copied Activity records.  Then using the Force.com DataLoader you can upload the copied Activity records and they will appear in the Activity History of the new Opportunity.  

 

The error you got is because the Activity Id and the Activity Record Id are two separate animals.

 

As far as "Any solutions to make this easier..." my suggestion would be to tell your user to stop being a crybaby, suck it up, and just re-enter the Activities for the new Opportunity.  

 

Lemme know if you need any help with this 

Stephen E 4Stephen E 4 
I am currently trying to parse an XML response, however it does not seem to want to parse whats being returned, and im not sure if its because of the complexity of the response, or if im doing something wrong.

I am using HttpRequests to send requets to our api. 

Here is the xml the API responds with:
 
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <getGLBranchResponse xmlns="our end point is here">
      <getGLBranchResult>
        <Branch>
          <ID>
            <Value>int</Value>
            <Valid>boolean</Valid>
          </ID>
          <Code>
            <Value>string</Value>
            <Valid>boolean</Valid>
          </Code>
        </Branch>
        <BranchName>
          <Value>string</Value>
          <Valid>boolean</Valid>
        </BranchName>
        <Customer>
          <ID>
            <Value>int</Value>
            <Valid>boolean</Valid>
          </ID>
          <Code>
            <Value>string</Value>
            <Valid>boolean</Valid>
          </Code>
        </Customer>
        <DefaultWarehouse>
          <ID>
            <Value>int</Value>
            <Valid>boolean</Valid>
          </ID>
          <Code>
            <Value>string</Value>
            <Valid>boolean</Valid>
          </Code>
        </DefaultWarehouse>
        <MainBranch>
          <Value>boolean</Value>
          <Valid>boolean</Valid>
        </MainBranch>
        <Active>
          <Value>boolean</Value>
          <Valid>boolean</Valid>
        </Active>
      </getGLBranchResult>
    </getGLBranchResponse>
  </soap:Body>
</soap:Envelope>

I use Dom.Document doc = res.getBodyDocument(); to get the document from the HTTP response. 

When I call Dom.XMLNode rootele = doc.getRootElement(); and put it in a system.debug, it doesnt really make much sense, returns something like:
 
[13]|DEBUG|XMLNode[ELEMENT,Envelope,http://schemas.xmlsoap.org/soap/envelope/,null,[common.apex.api.dom.XmlNode$NamespaceDef@c2d03a7, common.apex.api.dom.XmlNode$NamespaceDef@59ff7f61, common.apex.api.dom.XmlNode$NamespaceDef@32f5bbfc],[XMLNode[ELEMENT,Body,http://schemas.xmlsoap.org/soap/envelope/,null,null, etc

when I call getChildElement on this, it returns null, everytime. I have tried calling getChildElement('Envelope',null)​, getChildElement('Body',null)​ and many others. Always returns null. Am i doing something wrong? 
Best Answer chosen by Stephen E 4
Alain CabonAlain Cabon
Hi Stephen,

You have a common problem of namespaces (it is not "null" everywhere here).

<soap:Body> depends on the namespace xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"

If you don't precise the namespace, you can get the values depending of Body.

I often parse XML with Xquery requests and the namespaces are very important but the defaut examples in the documentation never use them.

getChildElement(name, namespace) : Returns the child element node for the node with the given name and namespace.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_xml_dom_xmlnode.htm

The complete solution here because there is a problem in the problem for this namespace sometimes:
https://developer.salesforce.com/forums/?id=906F0000000AbNMIA0 

Regards
Alain
Rachel ThibodauxRachel Thibodaux 
We have a custom object called Volunteer Hours. We created a rule the following criteria
(Volunteer Hours: Start DateLESS THANYESTERDAY) AND (Volunteer Hours: Clock InEQUALSnull)

The Workflow Action is a Field Update to change the Status of the Volunteer Hours to No Show if there was not a Clock In date & time, as this means the volunteer did not show up for the shift. We want it firing for all Volunteer Objects with a start date of yesterday or before.
User-added imageThis is the Field Update information. Anyone have an idea why it's not working?
Best Answer chosen by Rachel Thibodaux
Rachel ThibodauxRachel Thibodaux
Figured it out! The Evaluation Criteria needed to be changed.
Tanushree Singh 11Tanushree Singh 11 
I have a trigger as follows:

trigger LeadConvert on Lead (after update) {

  // no bulk processing; will only run from the UI
  if (Trigger.new.size() == 1) {

    if (Trigger.old[0].isConverted == false && Trigger.new[0].isConverted == true) {

      // if a new account was created
      if (Trigger.new[0].ConvertedAccountId != null) {

        // update the converted account with some text from the lead
        Account a = [Select a.Id, a.Initial_Payment__c, a.BPS__c,a.Monthly_Payment__c, a.X401_k_Plan_Type__c From Account a Where a.Id = :Trigger.new[0].ConvertedAccountId];
        if (a.X401_k_Plan_Type__c == 'Individual')
        {
            a.NumberOfEmployees = Integer.Valueof(Trigger.new[0].Number_of_Owners__c);
        }
        update a;

      }         

      }        

    }

  
}

It maps converted lead field to an account field.

Have written a test for the same which is giving 0% code coverage.

@isTest
private class LeadConvertTest {
@testSetup static void setup() {
        User users2=createUser();
        system.runAs(users2){
            Lead l1=new Lead();
            l1.LastName='test';
            l1.Number_of_Owners__c = 25;
            insert l1;
   
        }
    }
    
    @isTest
    static void updateAccount1(){
        user us2=[select Id from user where  Email ='xxx@ddd.com'];
        system.runAs(us2){
            Account a2=[select Id from Account limit 1];
            a2.X401_k_Plan_Type__c = 'Individual';
            update a2;
            
        }
        
    }
    
    
    private static user createUser(){
        User plannerUser2 = new User(
            ProfileId = [SELECT Id,name FROM Profile where name='System Administrator'].Id,
            LastName = 'last',
            Email = 'xxx@ddd.com',
            Username = 'xxx@ddd.com' + System.currentTimeMillis(),
            CompanyName = 'TEST1',
            Title = 'title',
            Alias = 'alias',
            TimeZoneSidKey = 'America/Los_Angeles',
            EmailEncodingKey = 'UTF-8',
            LanguageLocaleKey = 'en_US',
            LocaleSidKey = 'en_GB',
            IsActive=true);
        database.insert(plannerUser2);
        return plannerUser2;
    }
    
}

I am new to development and any help woulf be graetly appreciated.
Best Answer chosen by Tanushree Singh 11
Shubham_KumarShubham_Kumar
Hi Tanushree

Your trigger runs on after update and on converted Lead but you have not converted lead in your trigger. 
Try the below code and let me know if you have any queries.
 
@isTest
private class LeadConvertTest {
	
    
    @isTest
    static void updateAccount1(){
        
		
		test.startTest();
		
		User users2=createUser();
        system.runAs(users2){
			Account ac = new Account();// Set all your necessary fields before inserting account
			ac.Name = 'test Account';
			ac.X401_k_Plan_Type__c = 'Individual';
			insert ac;
			
            Lead leadToConvert=new Lead();
            leadToConvert.LastName='test';
            leadToConvert.Number_of_Owners__c = 25;
            insert leadToConvert;
			
			//Converting the inserted Lead		
			database.leadConvert lc = new database.leadConvert();
			lc.setLeadId(leadToConvert.id);
			leadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
			lc.setConvertedStatus(convertStatus.MasterLabel);
			lc.setAccountId(ac.Id);
			Database.LeadConvertResult lcr = Database.convertLead(lc);
			System.assert(lcr.isSuccess());
		    
		}
		test.stopTest();
        
	}
    
    
    private static user createUser(){
        User plannerUser2 = new User(
            ProfileId = [SELECT Id,name FROM Profile where name='System Administrator'].Id,
            LastName = 'last',
            Email = 'xxx@ddd.com',
            Username = 'xxx@ddd.com' + System.currentTimeMillis(),
            CompanyName = 'TEST1',
            Title = 'title',
            Alias = 'alias',
            TimeZoneSidKey = 'America/Los_Angeles',
            EmailEncodingKey = 'UTF-8',
            LanguageLocaleKey = 'en_US',
            LocaleSidKey = 'en_GB',
		IsActive=true);
        database.insert(plannerUser2);
        return plannerUser2;
	}
    
}
P.S: mark this as the best answer if this helped you

Thanks
Shubham Kumar
 
Peter Davids 4Peter Davids 4 

 
Hi all,

We need to implement the following pattern at my org:
  • callout to external data source
  • if that callout takes too long (according to some configurable threshold), log an error (ie do some DML)
  • if that callout timed out on the remote server, try it again
Recognizing the potential for the dreaded "You have uncommitted work pending. Please commit or rollback before calling out." error, I put the error logging code in a future method, thus isolating the DML from the callouts. However, the error is still being thrown. I reduced the issue down to this pattern:
public static void foo() {
    Http http = new Http();
    HttpRequest req = new Httprequest();
    req.setEndpoint('https://test.salesforce.com'); //whatever endpoint
    req.setMethod('GET');
    http.send(req); //works fine
    bar();
    http.send(req); //throws calloutexception
}

@future public static void bar() {

}
Am I correct to assume that calling a future method counts as a DML operation? Is there any documentation I'm missing somewhere?

 
Best Answer chosen by Peter Davids 4
Peter Davids 4Peter Davids 4
M ParnellM Parnell 
When attempting to create my Apex trigger for this Trailhead development exercise, I receive an error. I don't understand how this is possible, because the records haven't been updated, and still aren't updating.
"Challenge not yet complete... here's what's wrong:
Setting 'Match_Billing_Address__c' to false updated the records anyway. The trigger should only act when Match_Billing_Address__c is true."


Here's my code:
trigger AccountAddressTrigger on Account (before insert, before update) {

    for(Account a : Trigger.new){
        If (a.Match_Billing_Address__c = true) {
            a.ShippingPostalCode = a.BillingPostalCode;
        }   
    }

}


 
Best Answer chosen by M Parnell
Peter YohannaPeter Yohanna
You should use == insted of = , so your code should read as follows:
trigger AccountAddressTrigger on Account (before insert, before update) {

    for(Account a : Trigger.new){
        If (a.Match_Billing_Address__c == true) {
            a.ShippingPostalCode = a.BillingPostalCode;
        }   
    }

}

 
ALAL 
Is it possible to connect two Salesforce instances using named credentials and password authentication for the authentication protocol instead of OAuth 2.0? I've read that when connecting between two Salesforce instances, password authentication won't work. Thank you. 
Best Answer chosen by AL