Friday, October 24, 2014

Using Apex Param tag setting reference for the page elements



            We all know that we can communicate with pages and controllers using Getter setter methods but sometime we will be stuck in the scenario like referencing the Visualforce parent components to the controller. Lets discuss an example we have a list of records say it’s a wrapper list and below are the data types I defined inside the wrapper
  • String Name
  • String Email
  • Integer counter wrap
So the collection of whole data type is added in to a list and display this list in a Visualforce page   which will look something like this
..

On clicking the delete link the entire row gets deleted but not the data.  Let’s ask some questions to ourselves how to achieve this


1.       How the compiler knows on which “Delete  “ link is invoked inorder to get deleted?


2.       How to pass the reference parameter to check which row the user intends to delete?


These questions will be answered by Apex Parameter tag


What does this apex param tag do??
Apex parameter tag always will be the child component for the following parent tags
<apex:commandlink>
<apex>commandbutton>
<Apex:actionstatus>
<apex:actionFunction>
<apex:actionSupport>
<apex:outputtext>
Let’s get back to our example


First things first before diving deep into any technical code let me give the answers for the questions I asked above


1.        How the compiler know on which “Delete  “ link of the row the list index position should get deleted ?
In the wrapper list I have set an Integer variable which will act as an index element for each record in a list and when the user click on the delete link the param tag will pass the value to the controller. There we can identify if the record is equal to the integer value obtained from the param tag. It its operation to delete or remove the row can be applied.

2.       How to pass the reference parameter to check which row the user indents to delete?
I have set the value attribute from the integer value counter wrap


Scenario
           Let’s look at some sample code here how we did this.
In the Visualforce page


<apex:pageBlockTable value="{!wrapkeyconlist2}" var="i">    <apex:column headerValue="Action">       <apex:commandLink value="Delete" action="{!remove}" immediate="true">           <apex:param name="index" value="{!i.counterWrap}"/>         </apex:commandLink>   </apex:column> <apex:column value="{!i.keyconlist1.name}"/> <apex:column value="{!i.keyconlist1.FF__Email__c}"/> </apex:pageBlockTable>

In the controller remove method


  Integer param = Integer.valueOf(Apexpages.currentpage().getParameters().get('index'));   for(Integer i=0;i<wrapkeyconlist2.size();i++){  
if(wrapkeyconlist2[i].counterWrap == param ){  wrapkeyconlist2.remove(i); 
} 
counter--; 

Nirmal Christopher
SFDC certified force.com developer
Global Tech and Resorces

Tuesday, October 21, 2014

New upcoming Features to be considered on Dream force 2014 Platform Upgrade

Salesforce 1 Lightning


It's always a nightmare to develop UI in force.com platform until the developer knows the various UI components used. For Instance if we are developing a custom UI there is a set or predefined drag and drop feature available to create UI in IDE's provided for other platforms. Example:netbeans, Eclipse, Dream viewer etc..

But in salesforce there is no such tools available until now. But in dreamforce 14 salesforce launched a new app "Salesforce Lightning" which allows the user to create rich UI light weight components.

Now business users and developers can create hazzle free rich UI's for desktop application and salesforce1 platform. using the new app. Now it's is in beta release

  


Salesforce wave(analytics cloud)



In dreamforce 14 salesforce has launched a new app known as "Analyics Cloud". Like its predessors(Sales cloud,service cloud,Marketing cloud) its a new app is built natively on the salesforce  platform.

Its a licenced  feature and it's the first mobile analytics platform. The UI and the dashboard components are so rich which allows the user to use scalable,precise and rich dashboard and analytics component at the finger tip.

The UI is crystal clear and alllow the user to view the trending data in different components simultaneously. They can filter and search for the results and the real tim UI adopts the user input so dynamically like a wave. Its a WOW feature...

Follow the link to know more about the platform


Nirmal Christopher
SFDC certified force.com developer
Global Tech and Resorces