Tuesday, 20 November 2018

PackageBuilder & GitHub


1. How to download all the metadata from sandbox / Generate package.xml of all the components?

There are many ways to do this,Please Refer1,Refer2
     I used the this tool https://packagebuilder.herokuapp.com/
   


2. How to upload code to GitHub & Expose to publicly?

     
1. Sign Up
2. Create new repository
3. Commit one file [Ex: ReadMe file] to get the Upload Files button option for drag and drop files easily.
          
       







Thursday, 15 November 2018

SFDC Lightning Interview Questions



Before FAQ's,For quick understanding of Lightning Component Framework Refer


1. Why we should use lightning over VF ?


Lightning Component Framework
Visualforce
App Centric
Page Centric
Lightning Components process markup on the client.
Visualforce processes markup tags on the Salesforce server
Lightning, on the other hand, is a modern UI framework used in the development of dynamic web apps for desktop and mobile devices.
Visualforce enables developers to build custom user interfaces with a native hosting on the Force.com platform
It is responsive,
If you are developing for a Salesforce1 mobile app, you should prefer Lightning framework
If you want to create a page-centric experience with limited client-side logic, you must opt Visualforce framework.
UI Generation : Client-Side(Javascript)
UI Generation : Server-Side
Organizations that can’t use Apex code can’t use Lightning Components
Organizations that can’t use Apex code Still they can use Visualforce.
These applications are generally referred to as single-page applications, or SPAs, and are often built using third-party frameworks like AngularJS or React.
Visualforce provides the facility for delivering template-driven web pages and email messages
Fast Development,Client side & Server side work can be done independently
Its tightly copulped so development will have dependency.

1. Lightning Component Development will be faster because Client side and Server side task can be implemented independently.

2.Web applications are taking more advantage of the app-centric model,So it’s better to start with  Lightning.


2. Does lightning support all the browsers and versions ?



Lightning Experience is supported with Microsoft® Internet Explorer® version 11,Apple® Safari® version 8.x on Mac OS X. The most recent stable versions of Mozilla® Firefox® and Google Chrome™ are also supported. If you’re using Microsoft® Internet Explorer® versions 7–10, you’re redirected to Salesforce Classic. Refer
Real Time Exp:In order to support IE 11 we need to explicitly opt in for it in lightning experience settings. But since these settings are applicable for all users and turning it on could expose some security risks, so I have advised them to use another browsers for logging into salesforce.


3. Lightning Vs VF page - What is not possible with Lightning ?



1. Force.com sites directly doesn’t allow lightning components to add, Need to use VF page and host Lightning Component / App

2.If you are rendering pages as PDF in your application use Visualforce. Lightning components don’t support rendering as PDF output yet.


4. How can we embed VF page in Lightning Component ?


Use iframe to expose your visualforce pages within a lightning component

 



5. Have you faced the below error?Lightning components require My Domain. Please contact your system administrator for more information ? How did u fix that?



Yes,It will occur when the domain is not deployed to users.Fix : Setup-->Domain management -->my domain click on the button "Deploy to users"


6. How to create a lightning component to send email to salesforce ?



Ideally there is nothing from lightning component to send an email,To trigger email from lightning component there are few options

1.Apex : Use the lightning component to take the i/p parameter and pass that to  Apex.
2.Workflow /Process Builder : Trigger an email on save of the record and the lightning component has the logic to save the record then it triggers.
3.Call out to External Email Service: This is also via Apex instead of using our email service, you   could make a callout to an external email provider.Refer

7.  Experience with Custom Lightning Components ?


Yes worked in multiple projects,
1. Calendar lightning component is created for Tele Interviewer Booking
2. Display of report links & Knowledge Article links
3. Registration form

Issues :
1.Verify the component is loaded or not before communicating to other component. To avoid null exceptions.
·        Pseudocode :Create isLoad Boolean attribute with default value as false and in call back method on successful  return update this value to True.
2.One.app is needed and is available in lightning exp,It will not work in other container
          Ex: Force.com Sites
3. Collection with lot of data,Rendering issues.- Member,dependents
4. Single page application should not have large volume of data
5. Debugging is always challenging → Inspect elements
         

8. Explain your experience with Lightning Experience? Any migrations from classic to LEX?

Lightning Experience is a modern user interface that helps your sales reps sell faster and your service reps support customers more productively.
Lightning Experience includes many new features and entirely redesigned pages, but not every Salesforce feature is supported in Lightning Experience.

Note :

1.There is feature gap between Classic & LEXEx: Some works in classic /Some new features available only in LEX.

2. Salesforce product team is focusing on and moving forward with lightning,So it's better to migrate to LEX and Start any new development in LEX instead of Classic.
Ex:Financial Services Cloud (FSC)

Migrations from classic to LEX :

What will be the estimation ?
Depends on the complexity,If it is large enterprise client it may take multiple years.
Impact Analysis :
1.Generate “Lightning Readiness Check” report for Classic to LEX migration.
2. Domain Creation → Lightning exp enabled → 2 users as lightning users → To test completely
3.3rd party Apps of the Appexchange,Should get the lightning compatible version. 4.Sandbox wise also it will not work ,Need to check in all the environment
5.Rewrite or Refactor of some code may be needed to perform the functionality  correctly.
6.If you have custom buttons that use a JavaScript, you can use the Configuration Converter to convert these buttons and links to Lightning-Friendly alternatives since the JavaScript content source isn’t supported in Lightning Experience.
Alternates JS buttons :
  1. Lightning Quick Actions 
2. Custom Lightning Components     
7. Home page components need to be created again after migration,Reports and Dashboards  will not work,     
8. Classic & Lightning email templates need to be created differently     
9. VF pages with will not render in lightning properly,
Ex: Contact with 2 VF sections migrated to lightning

9. How we can do testing of UI / Lightning components ?


Lightning Test Service (LTS)  : Is a set of tools and services that let you create test suites for your lightning components using standard javascript test framework,Such as Jasmine and Mocha.   
Installing the LTS : There are 2 ways
1.Use the Salesforce DX CLI.
2.Manually install the unmanaged package. Refer


10. What is lightning out. ?

Lightning Out is a feature that extends Lightning Apps and acts as a bridge to surface Lightning Components in any remote web container.
This means you can use your Lightning Components inside of an external site,
1. Sharepoint ( Hybrid app built with the Mobile SDK)
2. SAP ( Hybrid app built with the Mobile SDK)
3. Heroku (App Cloud)
4. Visualforce (VF)
5. Node.Js Application        
Note : For external system mashups you will need to 1st establish connection with SFDC using connected apps.
Ex: Classic Console with  Lightning Out App Lightning Aura Application :        

:


11. What is lightning and how it is different from classic. ?



Lightning Exp :The overall intent of the redesign is to make the data and tools more accessible.
Setup → Lightning Experience → Enable It
Note : There will be few gaps & Limitations compared to classic salesforce team is fixing and releasing periodically.Refer

12. What is design tab used for in lightning bundle ?

There mainly 2 uses :
1. Design attribute is a configuration for admin.Anything wanted to expose to admin to enter that attribute can be made as design attribute.
Ex: Same component can be used in multiple applications by just passing the different design parameters.
Ex: Object in one component ,Then it should be placed in multiple other application for different other object ,Lightning page data table



2. Restrict the component based on object in lightning app builder.Map the lightning component only in particular object(s) lightning pages then we need to use <sfdc:object> tag in design resource.
Refer

13. How do l call one lightning component from another ?

A native lightning event “e.force:navigateToComponent” that will allow you to navigate from one lightning component to another. Traditionally, to get this done,you had to write your own lightning event.
Note : It will redirect to next component


Event Types:
Component events are parent-child relationships, in which an event registered in the child component can be handled only by the parent and not other sibling components.

Application events, on the other hand, are for sibling relationships. They can communicate with any other component.

The type of component is determined by the event file itself by setting the attribute on the <aura:event> tag to either COMPONENT or APPLICATION.

Lightning Component Communication Patterns : Always best practice is use Attribute/Methods while passing down the data & Use events while passing up
the data.


Application Event :


Register → Event Fire with parametersHandler → Receive and read the passed parameters var message = event.getParam("message");

Refer1

14.What is the role of helper in Lightning bundle ?

1.Reusable code need to be written in the Helper class, Code shared by your renderer and your controller or by multiple controller functions.That should go in the helper JS file.    
2. Helper code can be shared among components when they are related through inheritance. If one component extends another it inherits its super component's helper and can override it.           
3. Code Modularization - Send different parameters to same method
Ex:




Real time experience where forced to use helper over the controller           
Ex: Auto Refresh i have written a method it was allowed to place in Helper class

Best Practice :
Should try to delegate business logic to Helpers whenever possible.      

2. Anti-Pattern(s):Too many functions in the Helper: If you get into this situation, it’s time to refactor  the component itself into smaller sub components.    

Controllers v/s Helpers ?
Use Controllers to listen to user events and other events like component, application events. But delegate business logic to helper.

15. How to call apex controller without any button in lightning ?

1.On Standard events it can be called,
Ex: onInit / OnLoad      
2. AfterScriptsLoaded in Lighting Component  → 3rd party Js is loaded if we wanted to invoke apex    
Ex: Controller.js will be called after 3rd party JS is loaded

16. How to use slds in lightning ?

1. The Salesforce Lightning Design System (SLDS) provides a look and feel that’s consistent with Lightning Experience.

2. Use Lightning Design System styles to give your custom stand-alone Lightning applications a UI that is consistent with Salesforce, without having to reverse-engineer our styles.

3.The component is being rendered in the one.app container, SLDS will be available to your component automatically.

4.The Salesforce Lightning Design System is ready to use in your Lightning apps and components. It is now automatically included for Lightning Components running in the Lightning Experience and Salesforce S1 mobile application. It is no longer necessary to add a static resource for Lightning Components running within these environments.

Latest Way : Introduced in winter'16
Your application automatically gets Lightning Design System styles and design tokens if it extends


<aura:application extends="force:slds">
   <!-- customize your application here -->
</aura:application>

Older Way :  
This feature not available now.To use the static version of the Lightning Design System in a component, include it using <ltng:require/>


Refer1

17.What is the use of rerender in lightning bundle ?

Renderer service in lightning component bundle modify the DOM elements which is created by framework for a component. We use custom renderer to change override the default rendering behaviour of the component.Refer

18.Lightning Locker Service ?

Security Model for Lightning is locker service It is enforced by the system to limit the ability of one component's code to access other components on the page.

Why do we need security ?
Opens up lot of data to DOM,There is a threat to customer data




One lightning component has the access to other lightning component render data.

19. Lightning button Vs UI button ?

The lightning namespace components are optimized for common use cases. Beyond being equipped with the Lightning Design System styling, they handle accessibility, real-time interaction, and enhanced error messages.