Monthly Archive January 2018

Bynayakdillip

Navigate to lightning from visualforce page

On visualforce page you need to add below code.If you need to redirect to lightning page on button click or page load .You use below code
[html]
<script>
window.onload=function(){ 
 //get record ID
        var recordid='{!$CurrentPage.parameters.Id}’;//Its depend open your record id
if( (typeof sforce != ‘undefined’) && sforce && (!!sforce.one) ) {
            setTimeout(function(){
                // Salesforce1 navigation(Lightning Experience)
                sforce.one.navigateToURL(‘/’+recordid);
            }, 10);
}
}
</script>
[/html]

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 Componenet
File–>New–>Lightning Component

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

Paste the below code over the component

[html]
<!–HelloWorldCMP–>
<aura:component >
<p> Hello World </p>
</aura:component>
[/html]

Also you can add CSS on Click Style

CSS CODE

[html]
.THIS {
width:100px;
height:100px;
}
[/html]

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
[html]
<aura:application >
<c:HelloWorldCMP></c:HelloWorldCMP>
</aura:application>
[/html]

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

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

Component


[html]
<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>
[/html]

Controller JS
[html]
({
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();

}

})
[/html]

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.