Author Archive nayakdillip

Bynayakdillip

Create Hello World Lightning Component

Hello World Lightning Component

Step:-1: Login to Salesforce dev Org

https://login.salesforce.com/

Step:-2 Open Developer Console

Step:3 Create Lightning Component
File–>New–>Lightning Component

After Click on the lightning component, Enter Name and Description for the component.

Paste the below code over the component

<!--HelloWorldCMP-->
<aura:component >
	<p> Hello World </p>
</aura:component>

Also, you can add CSS on Click Style

CSS CODE

.THIS {
    width:100px;
    height:100px;
}

Step:-3 Create Lightning Application page For test the Lightning Componenet
File–>New–>Lightning Application

After click on the Lightning Application, Enter Name and Description for the page

Step:-4 Use your created Component over lightning application page

<aura:application >
	<c:HelloWorldCMP></c:HelloWorldCMP>
</aura:application>

Paste the below code

Step:-5 preview the page on click preview button

Output:-

Bynayakdillip

salesforce lightning navigate to record

$A.get(“e.force:navigateToSObject”) help you to navigate the sobject record for more detail please check below example

Apex Controller Class

public with sharing class AccountsController {
@AuraEnabled
public static list getAllAccounts()
{
return [select id,name,phone from account where phone!=null];
}
}

Component

<aura:component implements="flexipage:availableForAllPageTypes" access="global" controller="AccountsController" >
	<aura:attribute name="accounts" type="list"></aura:attribute>
     <aura:handler name="init" value="{!this}" action="{!c.doInit}"/>
    <aura:iteration var="account" items="{!v.accounts}">
        <lightning:card variant="Narrow" title="{!account.Name}">
        <aura:set attribute="actions">
            <lightning:button name="details" label="Details" onclick="{!c.goToRecord}"  />
        </aura:set>
        <aura:set attribute="footer">
            <lightning:badge label="{!account.Name}"/>
        </aura:set>
        <p>
           <a onclick="{!c.goToRecord}">{!account.Name}</a> 
        </p>
        <p>
            {!account.Phone}--{!account.Id}
        </p>
    </lightning:card>
    </aura:iteration>
</aura:component>

Controller JS

({
    doInit : function(component, event, helper) {
        
        var action=component.get("c.getAllAccounts");
        action.setCallback(this,function(response){
            
            var state=response.getState();
            if(state==="SUCCESS")
            {
                component.set("v.accounts",response.getReturnValue());
            }
            
            
            
        });
        $A.enqueueAction(action);
		
	},
    goToRecord:function(component, event, helper)
    {
        
        var sobjectEvent=$A.get("e.force:navigateToSObject");
        sobjectEvent.setParams({
            
            "recordId": component.get("account.Id")

        });
        sobjectEvent.fire();
        
    }
    
})

Made a lightning app using Lightning app builder to run it

Bynayakdillip

How do I change the background theme in Lightning App Builder?

In Setup–>Themes and Branding in the Quick Find box, then select Themes and Branding, and select Hide.

Bynayakdillip

ng-repeat load data but wont show until i click some button

ng-repeat load data but wont show until i click some button

Just apply

 

$scope.apply();

 

Cheer!!!

Bynayakdillip

Unable to Generate a Temporary Class

This error occurs winter’15 release.when you integrate WSDL over .net application

Step 1: Open the wsdl file.

Step:2 Find ListViewRecord

  1. <complexType name=“ListViewRecord”>
  2.    <sequence>
  3.       <element name=“columns” type=“tns:ListViewRecordColumn” maxOccurs=“unbounded”/>
  4.    </sequence>
  5. </complexType>

Step 3: Add “<xsd:attribute name=”tmp” type=”xsd:string” />”.

Over this section
  1. <complexType name=“ListViewRecord”>
  2. <sequence>
  3. <element name=“columns” type=“tns:ListViewRecordColumn” maxOccurs=“unbounded”/>
  4. </sequence>
  5. <xsd:attribute name=“tmp” type=“xsd:string” />
  6. </complexType>

Step 4: Update the webservice.

Now build the application its working like champ.