• BWS
  • NEWBIE
  • 20 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 5
    Replies
The Challenge for this (https://developer.salesforce.com/en/trailhead/force_com_programmatic_beginner/visualforce_fundamentals/visualforce_variables_expressions)Trailhead unit asks us to create a VisualForce page named "myHelloWorldVF" that displays the first name of the logged-in user.

Here is the VF I am using:
<apex:page>
{!$User.FirstName}
</apex:page>
(note: I have also tried wrapping the binding inside tags like <div>, <p>, <apex:outputText>, etc with no luck. I also tried minimizing the rendered output by including sidebar="false" standardStylesheets="false" showHeader="false")

The error returned in Trailhead after clicking "Check Challenge" is:
"Challenge not yet complete... here's what's wrong: 
The Visualforce page did not fit the criteria. The first name of the loged in user was not output using dynamic global variables." 

I am not aware of a different global var within VF for getting User attributes.

Anyone have luck with getting this one to pass?
  • October 28, 2014
  • Like
  • 0
Need test class for the following trigger with atleast 75 code coverage 

The below trigger  : Opportunity has a field where the associated  contact name should be populated (after lead conversion to acc,contact,opp)
trigger ContactNameUpdate on Lead (after update) 
{
  for(Lead l : System.Trigger.new) 
  {
    
   if(l.IsConverted && l.ConvertedOpportunityId != null) 
   { 
       
    Opportunity opp = [SELECT Id,Contact__c FROM Opportunity WHERE Id =: l.ConvertedOpportunityId];
    If(opp.Contact__c == null)
    { 
     opp.Contact__c = l.ConvertedContactId;
     update opp;
    }
   }
    
     
      
  }
Please give me the test class to cover 75 of code coverage to migration.......Very Critical
Please give me the test class to cover 75 of code coverage to migration.......Very Critical
Need test class for the following trigger with atleast 75 code coverage 
Trigger 1
The below trigger  : Lead and Contact have same checkbox fields, both object fields should have same value 
trigger checktheLeadCheckBox on Contact (after update) 
{
  for(Contact c : Trigger.New)
  {
    List<Lead> li = [select Id, Customer_of_PubKCyber__c,Email,Customer_of_PubKLaw__c from Lead where Email =: c.Email AND IsConverted =: false]; 
    for(Lead l : li)
    {
     If(l.Id != null)
     { 
       l.Customer_of_PubKCyber__c=c.Customer_of_PubKCyber__c;
       l.Customer_of_PubKLaw__c = c.Customer_of_PubKLaw__c;
       update l;
     }
    }
  }
}
Trigger 2 
The below trigger : checking the value of the checkboxes on Contacts object based on a condition 
trigger updatecontactcheckbox on Opportunity (after insert, after update) 
{    
    for(Opportunity o : Trigger.New)
    {
  
     if( o.Contact__c != null)                 
     {      
       Contact c = [select Id, Customer_of_PubKCyber__c,Email,Customer_of_PubKLaw__c from Contact where Id =: o.Contact__c ]; 
       
if((o.Subscription_Start_Date__c <= System.Today()) && (o.Subscription_End_Date__c >= System.Today()) && (o.Product_Name__c == 'PubKCyber Newsletter'))
    {
         c.Customer_of_PubKCyber__c = True;
        
    }
    else if(o.Product_Name__c == 'PubKCyber Newsletter')
         { 
           c .Customer_of_PubKCyber__c = false;
           
         }
          
if((o.Subscription_Start_Date__c <= System.Today()) && (o.Subscription_End_Date__c >= System.Today()) && (o.Product_Name__c == 'PubKLaw Newsletter'))
        { 
          c.Customer_of_PubKLaw__c= True;
         
        }
       else if(o.Product_Name__c == 'PubKLaw Newsletter')
         { 
           c.Customer_of_PubKLaw__c = false;            
         }
       update c; 
      }   
     }  
  }

Please give me the test class to cover 75 of code coverage to migration.......Very Critical
Please give me the test class to cover 75 of code coverage to migration.......Very Critical
The Challenge for this (https://developer.salesforce.com/en/trailhead/force_com_programmatic_beginner/visualforce_fundamentals/visualforce_variables_expressions)Trailhead unit asks us to create a VisualForce page named "myHelloWorldVF" that displays the first name of the logged-in user.

Here is the VF I am using:
<apex:page>
{!$User.FirstName}
</apex:page>
(note: I have also tried wrapping the binding inside tags like <div>, <p>, <apex:outputText>, etc with no luck. I also tried minimizing the rendered output by including sidebar="false" standardStylesheets="false" showHeader="false")

The error returned in Trailhead after clicking "Check Challenge" is:
"Challenge not yet complete... here's what's wrong: 
The Visualforce page did not fit the criteria. The first name of the loged in user was not output using dynamic global variables." 

I am not aware of a different global var within VF for getting User attributes.

Anyone have luck with getting this one to pass?
  • October 28, 2014
  • Like
  • 0
Hi All,

I'm trying to get an array of strings returned based on Integer n, but seem to keep getting a value instead of a string.  What do I need to adjust?  Thanks!

public class StringArrayTest {
    public void generateStringArray(){
        List<String>stringArray = new List<String>{};
        Integer n = 4;
        for(Integer i=n;i<stringArray.size();i++){
            String myInt = n.format();
            stringArray.add('Test' + myInt);
        }
         return stringArray;  
    }
}