Sunday 27 July 2014

Query String parameters in Links

You can set query string parameters in links to pages by constructing the link URL manually, or by using <apex:param> tags within the <apex:outputLink> tag.

<apex:outputLink value="http://google.com/search?q={!account.name}">
           Search Google

</apex:outputLink>


                                           OR

<apex:outputLink value="http://google.com/search">
     Search Google
     <apex:param name="q" value="{!account.name}"/>

</apex:outputLink>

my visualforce url would be

/apex/QueryStringInLink?Id=accountId


** We can use apex:param in 
1. apex:outputLink
2. apex:commandLink
3. apex:actionFunction

Tuesday 22 July 2014

                                                             Visualforce: label

In visualforce input component and some output components automatically display a form label for the field by default. To override the default value, and for component that aren't mapped directly to object fields, we can set the label attribute of the component.

example :
<apex:inputText value="{!Contact.Email}" label ="{!Contact.FirstName + 
' 's Email '}"/>


label will be look like


label attribute may be a string, or an expression that evaluates to a string.
If we set label to an empty string, the form label for that field will be suppressed.

Sunday 20 July 2014

                                 Redirecting to Object List Page


You can create visualforce page which will you redirect to list view of Object, this  will  be helpful when you don't have any Tab left. 

This can be useful for both standard and custom objects.


Create a vf page with a name you wish. In apex:page tag add action

action="{!URLFOR($Action.Account.List, $ObjectType.Account)}"

and save the page. As soon you save the page you will be redirected to Account list view page.

You can also use this for custom objects as well, all you have to do is to remove the Account and replace with API name of custom object.


action="{!URLFOR($Action.Employee_Name__c.List, $ObjectType.Employee_Name__c)}"

You can also create a custom link and add it to your Home Page layout