Tuesday 15 September 2015

New Lightning Experience Content over Traihead

Salesforce always brings new things but this time it brought amazing, fabulous thing for all of us no matter if we are Developers, Admins, Salesforce Rep.

"Salesforce brought-up a new Salesforce." it is nothing but new Lighting experience along with supporting classic one.

And also provided a great tool for getting started with it in easiest way. As I am developer so would like to bring you deep in new lightning dive.

Developer Trail - Lightning Experience | Salesforce Trailhead

So come with me visit few of my favorite content putting over there.

Lightning Experience Basics

To respond millions of feedback Salesforce bring some thing new which can
1. Fill gap between Dev, Admin & Sales Rep.
2. Save precious time of customer to do any activity in minimum clicks.
3. Help develop, access Apps compatible for different devices whether it is Desktop, Mobile or Tablae.

So Salesforce introduced new Lighting Experience. It faster, beautiful & more interactive. It is very easy to switch to or back to previous one based on user's preference.

Best feature I liked most is that Salesforce has given all control to end user for  getting new look & feel (experience) of doing things quickly just like light flash that's why it was called Lightning Experience.

in this series I have another content I would love most is

Using Visualforce in Lightning Experience

After getting a basic idea now next thing is to customization do lets go to development corner. Although we are moving ahead to new lightning experience but salesforce continue to support existing Visualforce development for Salesforce classic (existing Salesforce) as well as allowng visualforce development in new lightning experience.
Here are few steps like
build VF page-> Create Tab for it -> custom App and make it available in App Launcher.

A smplified way to test your page in Lightning Experience is just type the following into your JavaScript console as below:


$A.get("e.force:navigateToURL").setParams({"url": "/apex/pageName"}).fire();


now question raised that will Existing VF page will also work on new Lightning experience  then answer would yes but not fully as we need to make some required changes to do this.

so for more information you can quickly visit :https://developer.salesforce.com/trailhead/trail/lex_dev


Friday 4 September 2015

JSON Data Binding in Apex

While playing with JSON I came up with intersting usecase of binding JSON data in Class properties.

Here is JSON Data:
[ 
 {
  "ProductionHouse":"ABCD", 
  "Director":"Mr XYZ", 
  "Casting": [
   { "Title": "Play1", 
   "Artists": ["Artist1", "Artist2", "Artist3", "Artist4", "Artist0"]   
   },    
   {
   "Title": "Play2",
   "Artists": ["Artist1", "Artist2", "Artist0"] 
   }
  ]
 }
]
in order to coupling this data with some real time properties I have written below logic :
 Public Class Play_Controller{

    // JSON data binding with Class properties 
    public static void Databinding()
    {
        String inputJSON= '[    {   "ProductionHouse":"ABCD","Director":"Mr XYZ","Casting": [{ "Title": "Play1","Artists": ["Artist1", "Artist2", "Artist3", "Artist4", "Artist0"]             },  {"Title": "Play2","Artists": ["Artist1", "Artist2", "Artist0"] }]}]';
        List DataMainwrapperList = new List();
        DataMainwrapperList = (List< DataMainwrapper >)JSON.deserialize(inputJSON, List.class);

        for(DataMainwrapper Obj : DataMainwrapperList)
        {
            system.debug('---Prod House Name--'+Obj.ProductionHouse);
            system.debug('---Director--'+Obj.Director);
            for(CastingSubWrapper subobj : obj.Casting)
            {
                system.debug('---Play Title--'+subobj.Title);
                system.debug('---Play Artists--'+subobj.Artists);
            }
        }
    }
    
    // Wrapper holding properties of JSON with data upper leve
    public class DataMainwrapper{
        String ProductionHouse;
        String Director;
        List Casting;
    }

    // Wrapper holding properties of JSON with data sub level
    Public class CastingSubWrapper{
        String Title;
        List Artists;
    }    
}
//--Please Ignore below code line--
Further we can bind this data in respective objects in Apex. So I hope now it will helpful to understand how JSON data may enter in salesforce.