• Sattibabu
  • NEWBIE
  • 60 Points
  • Member since 2014
  • Mr.
  • Infosys Ltd

  • Chatter
    Feed
  • 1
    Best Answers
  • 8
    Likes Received
  • 0
    Likes Given
  • 8
    Questions
  • 17
    Replies
Can anyone actually get this trailhead to work?
https://developer.salesforce.com/trailhead/project/slds-lightning-components-workshop/slds-lc-4

​I've been trying to learn lightning / lds and maybe i'm missing something?

Component Code:
<aura:component >
  <aura:attribute name="class" type="String" description="CSS classname for the SVG element" />
  <aura:attribute name="xlinkHref" type="String" description="SLDS icon path. Ex: /assets/icons/utility-sprite/svg/symbols.svg#download" />
  <aura:attribute name="ariaHidden" type="String" default="true" description="aria-hidden true or false. defaults to true" />
</aura:component>
Render code:
({
	//Overwrite default render function for svg component
	render: function(component, helper){
		var classname = component.get("v.class");
		var xlinkhref = component.get("v.xlinkHref");
		var ariaHidden = component.get("v.ariaHidden");

		var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
		svg.setAttribute('class', classname);
		svg.setAttribute('aria-hidden', ariaHidden);
		svg.innerHTML = '<use xlink:href="'+ xlinkhref +'"></use>';
		return svg;
	}
})
App Code
<aura:application >
  <div class="slds">
    <ltng:require styles="/resource/SLDS0120/assets/styles/salesforce-lightning-design-system-ltng.css" />
    <span class="slds-icon__container slds-icon-standard-account">
      <c:svg class="slds-icon" xlinkHref="/resource/SLDS0120/assets/icons/standard-sprite/svg/symbols.svg#account" />
        <span class="slds-assistive-text">Account Icon</span>
    </span>
  </div>
</aura:application>
Error:
Error during init : Object doesn't support property or method 'replace'

​Also, enabling debug on lightning components doesn't seem to make a difference, no error is thrown in console so I'm not sure really how to even find my JS in the console sources.
 
In Salesforce Connect -->Integrate External Data module , Navigation to External object called ' Order' is wrong. Please correct it.
  1. In Setup, use the Quick Find box to go to the Object Manager. - Here instead of Object Manager , it shoud be 'External Objects'. 
  2. Click the Order object, then click Page Layouts | Order Layout.
  3. In the Order Layout box, click Related Lists.
We are experiencing some issues after Winter 18. I am not sure whether they are particular to our project or know issues.  Any help on below issues woule  greatly appreciated. 

Issue # 1:
We have noticed that some of our custom css classes are getting overridden with app.css and because of that our UI screens are getting distored.  

Issue#2:
One more issue is that whenever we do code changes through developer console , changes are not getting updated immediately at UI. We suppose to refresh the browser multiple times to see the updated change. It's really effecting our developement time.  This is not the case before winter18.

 
I am getting below error message whenever I try to edit and save record of custom object called ‘ Connection Point.
I have used ‘ force:recordEdit ‘ event for editing and saving the record.

User-added image

CW_ActivationPlanningList component.

User-added image

Edit modal after clicking on ‘Edit’ button from the above component.

User-added image

After clickion on save , below error message is coming
Access Check Failed! Component.getEvent():'recordSave' of component 'markup://force:recordEdit {1145:0} {edit}' is not visible to 'markup://c:CW_ActivationPlanningList {376:401;a}'.

Technical Details:
I  have defined  force:recordSave and force:recordEdit using aura:dependency inside the source component.

User-added image

Portion of code where I am opening the Modal using ‘ force:recordEdit ‘ event.  
User-added image

“editConnectionPoint” method will get called whenever  we click on Edit button from source component.
“saveEditedRecord”  method will get called after clicking on save method.
 
editConnectionPoint : function(component, event, helper) {
        var cpId = event.target.id;
        console.log('Inside Edit button click -cpId ' +cpId);
        component.set("v.showEdit",true);
        component.set("v.recordIdToEdit",cpId);
        
    },
    navigateToCpDetail : function (component, event, helper) {
        var cpId = event.target.id;
        var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
            "recordId": cpId,
            "slideDevName": "related"
        });
        navEvt.fire();
    },
    //To Save Record From Standard Edit page as modal
    saveEditedRecord : function(component, event, helper) {    
        console.log('getEvent-element' +component.find("edit"));
        console.log('inside after clicking on save button' +component.find("edit").get("e.recordSave"));
        if(component.find("edit").get("e.recordSave") !== null){        
        component.find("edit").get("e.recordSave").fire();
        }
    },

 //To confirm edited record is saved and to refresh list
    afterSaveForceEdit : function(component, event, helper) {
        console.log('inside after successful save');
        component.set("v.showEdit",false);
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Success!",
            "message": "The record has been updated successfully.",
            "type":"success"
        });
        toastEvent.fire();
        helper.helperInitAction(component,event,helper);
    },
  
  Note: This issus is not consistent, sometimes it's working and sometime throwing the given error. Any help would be greatly appreciated.

 
Hi All,
I have requirement where i suppose to fire application event from VF page. VF page will open as pou-up on click of button in Lightnign component. After completion of transaction (adding object record ) in VF page, VF page will fire an applicaiton event . I am handling same application event from Lightning compoent. I can see event attribute value passing from VF page to lightning hanlder method. However when i set event attribute value to Lightning attribute , component is not getting rendered. 

If i do the samething by using component event inside the component , i can see component get rendered with udpated value.
This Handler Method is for handling event fired from VF. Here we’re setting ‘stage’ attribute  
User-added image

Can someone guide us what went wrong with this approach . Thanks in advance. 

 
Hi All , 

I have requirement where i need to create Lightening component which should generate Gantt chart on specified object. Gantt should populate on the detail page of the specified object.  Downthe line that component provides the flexitbilty to be used in salesforce 1 or inside visualforce pages. 

As i new to the Lightenign framework. Can one someone suggest me the functional flow (design) to create a gantt chart component. Any help would be greatly appreciated. Thank you.
How to write test method for the below method:
public String getCaseURL()
     {
      return (new pagereference('/apex/MyVisualforcepage?id='+camp.id).getContent().toString());
     }
When i try to call this method in my test class. It's giving the following error. 
"Methods defined as TestMethod do not support getContent call, test skipped"

How to cover getContent() method in test class. Anyhelp would be greatly appreciated. 

 
How to dynamically get values of options we select from PICKLIST . For example I have an account picklist on my VF page which has all the account names as pick list option values. Whenever I select account name from pick list , respective account details like accountname, contact name, oppty name should populate dynamically on the same VF page.

Detailed Description of the requirement :
1. A drop down on Accounts
2. On selecting a particular Account need to get following details:
      A. Opportunities associated with that account
      B. Contact Person for that opportunity- Name if one contact person, number with embedded hyperlink in case of more than one( Hyperlink                should lead to all contact with following information  : Name, Account , Email id)
      C. Lead Name if opportunity has originated from Lead Conversion    
      ​D. Lead Owner of that particular lead.


I can able to dynamically get account values from controller class to Account picklist in VF page, but I don’t know how to display account details(each account we select in picklist) in the same VF page of other section.

Please check my below incomplete VF page and Controller class:
<---VF Page to To get Account PickList and to display each account details: --->

<apex:page controller="AccountDetails">

  <apex:form >
  <apex:pageblock title="AccountDetails" id="camps_list">
  <table style="width: 100%"><tr>
  <td>

          <apex:outputLabel value="Account Name:"/>
          <apex:selectList value="{!filterid}" size="1">
          <apex:actionSupport event="onchange" action="{!fetchRecords}"  rerender="cases_table"/>
          <apex:selectOptions value="{!AccountList}"></apex:selectOptions>
          </apex:selectList>
 </td>
 
 <td>
  No Of Records Displayed:
<apex:selectList value="{! PageSize }" size="1" id="sl">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="20"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>

 </td>
</tr>
</table>
</apex:pageBlock>

<apex:pageBlock >

<h1>AccountRelated List records</h1>

</apex:pageblock>
 
  </apex:form>
</apex:page>

<----Controller Class--->

public without sharing class AccountDetails 
{

    public String results { get; set; }

    public String filterid { get; set; }

    public String fetchRecords { get; set; }
    public String PageSize { get; set; }
    public List<Account> accts = new List<Account>();
    public List<Contact> listContacts {get;set;}
    public List<Case> listCases {get;set;}
    public List<Opportunity> listOpptys {get;set;}
    public String selectedAcctId {get;set;}

    public AccountDetails()
    {
    
    }
    
    public List<SelectOption> AccountList
    {
        get
        {
            accts = [Select u.name, u.Id From Account u];
            
            AccountList = new List<SelectOption>();
            
            for(Account tempacct: accts)
            {
                AccountList.add(new SelectOption(tempacct.Id, tempacct.Name));
            }
            return AccountList;
        }
        set;
    }
    
   public void fetchRecords() {
        
    }
    
}
Please can someone help me on it
 
Create an Apex class that returns an array (or list) of strings: 
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.

MyApexClass to above Challenge:

public class StringArrayTest {
    
    public static List<string> generateStringArray(Integer n)
    {
        List<String> myArray = new List<String>();
        
        for(Integer i=0;i<n;i++)
        {
            myArray.add('Test'+i);
            System.debug(myArray[i]);
        }
        return myArray;
        
    }


It's compile and execute as per requirement in Developer console. But Traihead showing the below 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.

Anyhelp would be greatly appreciated. Thanks.
 
In Salesforce Connect -->Integrate External Data module , Navigation to External object called ' Order' is wrong. Please correct it.
  1. In Setup, use the Quick Find box to go to the Object Manager. - Here instead of Object Manager , it shoud be 'External Objects'. 
  2. Click the Order object, then click Page Layouts | Order Layout.
  3. In the Order Layout box, click Related Lists.
How to dynamically get values of options we select from PICKLIST . For example I have an account picklist on my VF page which has all the account names as pick list option values. Whenever I select account name from pick list , respective account details like accountname, contact name, oppty name should populate dynamically on the same VF page.

Detailed Description of the requirement :
1. A drop down on Accounts
2. On selecting a particular Account need to get following details:
      A. Opportunities associated with that account
      B. Contact Person for that opportunity- Name if one contact person, number with embedded hyperlink in case of more than one( Hyperlink                should lead to all contact with following information  : Name, Account , Email id)
      C. Lead Name if opportunity has originated from Lead Conversion    
      ​D. Lead Owner of that particular lead.


I can able to dynamically get account values from controller class to Account picklist in VF page, but I don’t know how to display account details(each account we select in picklist) in the same VF page of other section.

Please check my below incomplete VF page and Controller class:
<---VF Page to To get Account PickList and to display each account details: --->

<apex:page controller="AccountDetails">

  <apex:form >
  <apex:pageblock title="AccountDetails" id="camps_list">
  <table style="width: 100%"><tr>
  <td>

          <apex:outputLabel value="Account Name:"/>
          <apex:selectList value="{!filterid}" size="1">
          <apex:actionSupport event="onchange" action="{!fetchRecords}"  rerender="cases_table"/>
          <apex:selectOptions value="{!AccountList}"></apex:selectOptions>
          </apex:selectList>
 </td>
 
 <td>
  No Of Records Displayed:
<apex:selectList value="{! PageSize }" size="1" id="sl">
    <apex:selectOption itemValue="5" itemLabel="5"/>
    <apex:selectOption itemValue="20" itemLabel="20"/>
    <apex:actionSupport event="onchange" reRender="contacts_list"/>
</apex:selectList>

 </td>
</tr>
</table>
</apex:pageBlock>

<apex:pageBlock >

<h1>AccountRelated List records</h1>

</apex:pageblock>
 
  </apex:form>
</apex:page>

<----Controller Class--->

public without sharing class AccountDetails 
{

    public String results { get; set; }

    public String filterid { get; set; }

    public String fetchRecords { get; set; }
    public String PageSize { get; set; }
    public List<Account> accts = new List<Account>();
    public List<Contact> listContacts {get;set;}
    public List<Case> listCases {get;set;}
    public List<Opportunity> listOpptys {get;set;}
    public String selectedAcctId {get;set;}

    public AccountDetails()
    {
    
    }
    
    public List<SelectOption> AccountList
    {
        get
        {
            accts = [Select u.name, u.Id From Account u];
            
            AccountList = new List<SelectOption>();
            
            for(Account tempacct: accts)
            {
                AccountList.add(new SelectOption(tempacct.Id, tempacct.Name));
            }
            return AccountList;
        }
        set;
    }
    
   public void fetchRecords() {
        
    }
    
}
Please can someone help me on it
 
Create an Apex class that returns an array (or list) of strings: 
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.

MyApexClass to above Challenge:

public class StringArrayTest {
    
    public static List<string> generateStringArray(Integer n)
    {
        List<String> myArray = new List<String>();
        
        for(Integer i=0;i<n;i++)
        {
            myArray.add('Test'+i);
            System.debug(myArray[i]);
        }
        return myArray;
        
    }


It's compile and execute as per requirement in Developer console. But Traihead showing the below 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.

Anyhelp would be greatly appreciated. Thanks.
 
I am getting below error message whenever I try to edit and save record of custom object called ‘ Connection Point.
I have used ‘ force:recordEdit ‘ event for editing and saving the record.

User-added image

CW_ActivationPlanningList component.

User-added image

Edit modal after clicking on ‘Edit’ button from the above component.

User-added image

After clickion on save , below error message is coming
Access Check Failed! Component.getEvent():'recordSave' of component 'markup://force:recordEdit {1145:0} {edit}' is not visible to 'markup://c:CW_ActivationPlanningList {376:401;a}'.

Technical Details:
I  have defined  force:recordSave and force:recordEdit using aura:dependency inside the source component.

User-added image

Portion of code where I am opening the Modal using ‘ force:recordEdit ‘ event.  
User-added image

“editConnectionPoint” method will get called whenever  we click on Edit button from source component.
“saveEditedRecord”  method will get called after clicking on save method.
 
editConnectionPoint : function(component, event, helper) {
        var cpId = event.target.id;
        console.log('Inside Edit button click -cpId ' +cpId);
        component.set("v.showEdit",true);
        component.set("v.recordIdToEdit",cpId);
        
    },
    navigateToCpDetail : function (component, event, helper) {
        var cpId = event.target.id;
        var navEvt = $A.get("e.force:navigateToSObject");
        navEvt.setParams({
            "recordId": cpId,
            "slideDevName": "related"
        });
        navEvt.fire();
    },
    //To Save Record From Standard Edit page as modal
    saveEditedRecord : function(component, event, helper) {    
        console.log('getEvent-element' +component.find("edit"));
        console.log('inside after clicking on save button' +component.find("edit").get("e.recordSave"));
        if(component.find("edit").get("e.recordSave") !== null){        
        component.find("edit").get("e.recordSave").fire();
        }
    },

 //To confirm edited record is saved and to refresh list
    afterSaveForceEdit : function(component, event, helper) {
        console.log('inside after successful save');
        component.set("v.showEdit",false);
        var toastEvent = $A.get("e.force:showToast");
        toastEvent.setParams({
            "title": "Success!",
            "message": "The record has been updated successfully.",
            "type":"success"
        });
        toastEvent.fire();
        helper.helperInitAction(component,event,helper);
    },
  
  Note: This issus is not consistent, sometimes it's working and sometime throwing the given error. Any help would be greatly appreciated.

 
Trying to duplicate a  process that was developed in Salesforce Classic.  What should happen is a method in a controller should be launched on page load of  a visual force page, the constructor should do some work and return  a parm to the visualforce page.  Do not want to click more buttons other than the initial "action button" that calls a visualforce page.  Could someone please explain what is in error here?  Is this the correct path to take?  
<apex:page standardController="Opportunity" extensions="opportunityMockUp" showQuickActionVfHeader="false"> 
<script>  
         window.onload = new function() { buildURL(); };
            function buildURL()
            {
			//Just a container to launch the action button
            };   
  </script>
  <script>          
            function navigateToMockUp(){            
               if ( (typeof sforce != 'undefined') && (sforce != null) )  {s
                   alert('{!theBuiltURL}');
                    sforce.one.navigateToSObject('{!theBuiltURL}');
                } else {
                    window.location='/' + '{!theBuiltURL}';
               }        
            }
</script>
   <apex:form >
       <apex:actionFunction name="buildURL" action="{!autoRun}" rerender="none" oncomplete="navigateToMockUp();">
       </apex:actionFunction>
</apex:form>
</apex:page>
 
public with sharing class opportunityMockUp{
//Define the Project Object
    Opportunity theOpportunity = new Opportunity(); 
    String thePageOpportunityId;  
    String theOpportunityID; 
    String theOppName;
    String theAccountID;
    String theAmount;
    String theOppNumber;
    String theQuote;
    String theSalesRep;
    String theDistrictName;
    String theRegion;
    String theProjectCoordinator;
    String theMockUpName;
    String theTarget;
    String theParameters;
    String theValues;   
    String theURL;
    String theAccountName;
    public String theBuiltURL {get;set;}
       
    // Constructor - this only really matters if the autoRun function doesn't work right     
    public opportunityMockUp(ApexPages.StandardController stdController) {        
        this.theOpportunity = (Opportunity)stdController.getRecord();   
     } 
    
    // Code invoked on page load.      
    public PageReference autoRun()
    {           
        thePageOpportunityId = ApexPages.currentPage().getParameters().get('id'); 
        if (thePageOpportunityId == null) 
        {             
            // Display the Visualforce page's error message if no Id is passed over             
            return null;         
        }       
      
    for (Opportunity theOpportunity:[select Id, Name, Accountid, Account.Name, Amount, Opportunity_Number__c, KI_Quote__c, Sales_Representative__c,District_Name__c,Region__c, 	Project_Coordinator__c, KCO_Competition_Current_Suppliers__c from Opportunity where id =:thePageOpportunityId Limit 1]) 
    {               
        theTarget = '&00N50000002pCh2'; 
        theParameters = '';
        theValues = theOpportunity.KCO_Competition_Current_Suppliers__c; 
        if (theValues != null && theValues  != '' && theValues != '0'){
        List<String> theValueArray = theValues.split(';'); 
        for (integer i=0; i < theValueArray.size(); i++) { 
          theParameters = theParameters + theTarget + '=' + theValueArray[i] ; 
        system.debug('TheParms: ' + theParameters);
        }
        }  
        else
        {
          theParameters = '';
        }
        
        theMockUpName = 'Mock Up: ' + theOpportunity.Name;
        theAmount = String.ValueOf(theOpportunity.Amount);
        if (theAmount != null && theAmount != '') {
        theAmount = theAmount.Substring(0,3);
        }
        else
        {
          theAmount = '0';
        }
         
        theOpportunityID = theOpportunity.Id; 
        theAccountID = theOpportunity.Accountid; 
        theAccountName = theOpportunity.Account.Name;
        theOppName = theOpportunity.Name;
        theOppNumber = theOpportunity.Opportunity_Number__c;
        theQuote = theOpportunity.KI_Quote__c;  
        if (theOpportunity.KI_Quote__c != null && theOpportunity.KI_Quote__c != '') {
        theQuote = theOpportunity.KI_Quote__c;  
        }
        else
        {
          theQuote = '';
        }
        theSalesRep = theOpportunity.Sales_Representative__c;
        theDistrictName = theOpportunity.District_Name__c;
        theRegion = theOpportunity.Region__c;
        theProjectCoordinator = theOpportunity.Project_Coordinator__c;
        theOpportunityID = theOpportunity.id; 
        TheURL = '/a0G/e?CF00N500000026uRE=' + theOppName + '&CF00N500000026uR5=' + theAccountName + '&00N50000002pCi0=' + theOppNumber + '&00N50000002pCuV=' + theQuote + 	'&00N500000026uRM=' +  theSalesRep + '&00N50000002pCmW=' + theDistrictName + '&00N50000002pCmb=' + theRegion + theParameters + '&00N500000026uRK=' + theAmount + 	'&00N500000026uRK=' + theProjectCoordinator + '&Name=' + theMockUpName + '&retURL=/' + theOpportunityID + ' target="blank"';  
          system.debug('TheURL 1: = ' + TheURL);
        //TheURL = EncodingUtil.URLENCODE(TheURL,'UTF-8');
            system.debug('TheURL 2: = ' + TheURL);
        theBuiltURL = TheURL;    
        }  
     return null;
    }

 

Hello!

How can I get my standalone Lightning App, https://ajith-dev-ed.lightning.force.com/c/myTestApp.app listed under Lightning Experience > App Launcher?

I created the above sample App by following the below article,
https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/qs_aotp_app_step1.htm

Any inputs really appreciated! Thx!

 

Can anyone actually get this trailhead to work?
https://developer.salesforce.com/trailhead/project/slds-lightning-components-workshop/slds-lc-4

​I've been trying to learn lightning / lds and maybe i'm missing something?

Component Code:
<aura:component >
  <aura:attribute name="class" type="String" description="CSS classname for the SVG element" />
  <aura:attribute name="xlinkHref" type="String" description="SLDS icon path. Ex: /assets/icons/utility-sprite/svg/symbols.svg#download" />
  <aura:attribute name="ariaHidden" type="String" default="true" description="aria-hidden true or false. defaults to true" />
</aura:component>
Render code:
({
	//Overwrite default render function for svg component
	render: function(component, helper){
		var classname = component.get("v.class");
		var xlinkhref = component.get("v.xlinkHref");
		var ariaHidden = component.get("v.ariaHidden");

		var svg = document.createElementNS("http://www.w3.org/2000/svg", "svg");
		svg.setAttribute('class', classname);
		svg.setAttribute('aria-hidden', ariaHidden);
		svg.innerHTML = '<use xlink:href="'+ xlinkhref +'"></use>';
		return svg;
	}
})
App Code
<aura:application >
  <div class="slds">
    <ltng:require styles="/resource/SLDS0120/assets/styles/salesforce-lightning-design-system-ltng.css" />
    <span class="slds-icon__container slds-icon-standard-account">
      <c:svg class="slds-icon" xlinkHref="/resource/SLDS0120/assets/icons/standard-sprite/svg/symbols.svg#account" />
        <span class="slds-assistive-text">Account Icon</span>
    </span>
  </div>
</aura:application>
Error:
Error during init : Object doesn't support property or method 'replace'

​Also, enabling debug on lightning components doesn't seem to make a difference, no error is thrown in console so I'm not sure really how to even find my JS in the console sources.
 
Hello!

I created my own Lightning app and Ligthnng Component. Also I use Lightning Desigh System.
I placed table in the component. And it has a lot of records. I would like to display records by pages and I would like to navigate between pages. How can I do pagination for my table? May be using Lightning Design System.

Thank you in advice!

Hi All,

After attempting lighting component module.I am facing with the following problem.
https://developer.salesforce.com/trailhead/force_com_dev_intermediate/lightning_components/lightning_components_events_handle
1-PhoneNumberInput.cmp
<aura:component >
    <aura:registerEvent name="PhoneNumberEvent" type="c:PhoneNumberEvent"/>
    <ui:inputPhone aura:id="phone" label="phone" />
    <ui:button label="Show Phone" press="{!c.send}"/>
</aura:component>

2-PhoneNumberOutput.cmp
<aura:component >
    <aura:attribute name="phone" type="String" default="No Phone Number"/>
    <ui:outputText aura:id="phone" value="{!v.phone}"/>
    <aura:handler event="c:PhoneNumberEvent" action="{!c.answer}"/>
</aura:component>

3-PhoneNumberEvent.evt
<aura:event type="APPLICATION" description="Event template">
    <aura:attribute name="phone" type="String"/>
</aura:event>


4-PhoneNumberInputController.js

({
    setphone:function (component, event,helper){
        var phone=component.find("phone").get("v.value");
        $A.get("e.c:PhoneNumberEvent").set Params({
            phone:phone
        }).fire(),
    }
        
    })

5-PhoneNumber.app
<aura:application >
    <c:PhoneNumberInput />
    <c:PhoneNumberOutput />
</aura:application>

User-added image

Thanks 
Prashant 

How to write test method for the below method:
public String getCaseURL()
     {
      return (new pagereference('/apex/MyVisualforcepage?id='+camp.id).getContent().toString());
     }
When i try to call this method in my test class. It's giving the following error. 
"Methods defined as TestMethod do not support getContent call, test skipped"

How to cover getContent() method in test class. Anyhelp would be greatly appreciated. 

 
Create an Apex class that returns an array (or list) of strings: 
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.

MyApexClass to above Challenge:

public class StringArrayTest {
    
    public static List<string> generateStringArray(Integer n)
    {
        List<String> myArray = new List<String>();
        
        for(Integer i=0;i<n;i++)
        {
            myArray.add('Test'+i);
            System.debug(myArray[i]);
        }
        return myArray;
        
    }


It's compile and execute as per requirement in Developer console. But Traihead showing the below 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.

Anyhelp would be greatly appreciated. Thanks.
 
Other people have had this problem and concluded that it had something to do with having a namespace. But this is a new developer org I set up specifically for Trailhead, no namespace. I am still getting an error on this, I have verified the exact wording, tested the workflow, and saw the task created . But when I try to verify the Challenge I get the following message:  " Challenge not yet complete... here's what's wrong:
The 'Follow Up on Escalated Case' Workflow assign task action was not found."
Thought this challenge was pretty straight forward, but I'm not sure what to do based on the error message; here is the challenge copy&paste:

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's my Apex Class:


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

And here's the error message upon checking that class upon:

Executing the 'generateStringArray' method failed. Either the method does not exist, is not static, or does not return the proper number of strings.
Hi All,

Below are the requirements to complete Challenge

The Account object will need a new custom checkbox that should have the Field Label 'Match Billing Address' and Field Name of 'Match_Billing_Address'. The resulting API Name should be 'Match_Billing_Address__c'.
With 'AccountAddressTrigger' active, if an Account has a Billing Postal Code and 'Match_Billing_Address__c' is true, the record should have the Shipping Postal Code set to match on insert or update.


I have created new custom Checkbox(MatchBillingAddress) and Below is my trigger:

trigger AccountAddressTrigger on Account (before update,before insert)
{
   List<Account> list1=[SELECT Id,Match_Billing_Address__c,ShippingPostalCode,BillingPostalCode from Account];
  for(Integer i=0;i<list1.size();i++)
   {
    if(list1[i].Match_Billing_Address__c=true && list1[i].BillingPostalCode!=NULL)
    {
    list1[i].ShippingPostalCode=list1[i].BillingPostalCode;
    update list1[i];
    }
   }
  }

I got Error like : Executing the trigger did not work as expected.

Can anyone please help me to achieve this. Thanks
This challenge seems simple enough but I'm stuck and any help would be appreciated. 

So the Challenge is Create a validation rule to check that a contact is in the zip code of its account. here is the question below:
To complete this challenge, add a validation rule which will block the insertion of a contact if the contact is related to an account and has a mailing postal code (which has the API Name MailingPostalCode) different from the account's shipping postal code (which has the API Name ShippingPostalCode).Name the validation rule 'Contact must be in Account ZIP Code'.
A contact with a MailingPostalCode that has an account and does not match the associated Account ShippingPostalCode should return with a validation error and not be inserted.
The validation rule should ONLY apply to contact records with an associated account. Contact records with no associated parent account (hint: you can use the ISBLANK function for this check) can be added with any MailingPostalCode value

Here is my  work.. Any help would be appreciated.. thanks, 

Rule Name Contact_must_be_in_Account_ZIP_Code Active [Checked]
Error Condition Formula AND( BillingPostalCode = ShippingPostalCode )
Error Message Billing zipcode does not match the Shipping Zipcode Error Location Billing Zip/Postal Code



 

 

 


A developer needs to support multiple currencies for a custom object in an application? Multi-currency has been enabled, what does the developer need to know to support the application?
(2 answers)

  

 

A.

Must input currency ISO Field

 

B.

Admin can add additional currencies once set up

 

C.

Roll up summary fields will calculate incorrectly if children have multiple currencies

 

D.

Track Currency changes automatically.

 

 

 

Hi please anyone answer this question , am preparig for 401 exam.