Posts

Showing posts from June, 2011

Summer '11 New Features - part 1 (Javascript Remoting)

JavaScript remoting was released as a Developer Preview in Spring '11. In Summer '11, JavaScript remoting now supports additional return data types. Also, references to the same objects are no longer duplicated in the response. Javascript remoting is the process that provides support for some methods in APEX controllers to be called via Javascript.

This is an interesting feature and it'll be a good move to the interactive and fast user interface creation in visualforce. I have mentioned about javascript remoting one of my previous post. There is a nice example about Javascript Remoting.


Real-time sandbox environments in Salesforce

Parameter passing using Javascript+actionFunction in visualforce

In visualforce, there is a method for passing parameters from visualforce page to controller using javascript and actionFunction. Here is the example;
/*JavaScript*/<script type="text/javascript">
function doSave(date) {
paraFunction(document.getElementById(date).value);
}
</script>
/*Action Function*/<apex:actionFunction name="paraFunction" action="{!saveInterviewDate}" rerender="view">
<apex:param id="aname" name="interviewDate" value="" />
</apex:actionFunction>
/*Call the javaScript from here*/<apex:commandLink onclick="doSave('{!$Component.interviewDate}');">
<apex:commandButton value="Save"/>
</apex:commandLink>
/*get the parameter in controller*/String interviewdate=Apexpages.currentPage().getParameters().get('interviewDate');
</

Javascript Remoting for APEX controller

Javascript remoting is the process that provides support for some methods in APEX controllers to be called via Javascript.The @RemoteAction annotation is currently available as a Developer preview.You have to contact Salesforce.com support to enable this feature.To use Javascript remoting, your request must take the following form:

Javascript with Visualforce pages

Javascript is one of key browser technology on Visualforce pages. Javascript provides the framework for communication between other Javascript objects, HTML elements and visualforce controller. This example will explain how can we use javascripts in visualforce pages.

<apex:page>

<script>
function changeFont(input, textid) {
if(input.checked) document.getElementById(textid).style.fontWeight = "bold";
else document.getElementById(textid).style.fontWeight = "normal";
}
</script>


<apex:outputPanel layout="block">
<label for="checkbox">Click this box to change text font: </label>
<input id="checkbox" type="checkbox"
onclick="changeFont(this,'{!$Component.thePanel}');"/>
</apex:outputPanel>

<apex:outputPanel id="thePanel" layout="block">Change me!
</apex:outputPanel>
</apex:page>

'{!$Component.idName}' : This is the way of passing part…

Multi-Currency in Salesforce.com

Basically the multi-currency feature is not available in your organization on salesforce. We have to log a case or contact salesforce support team for activate the multi-currency feature on your organization.This request can only be made by a System AdministratorPrior to converting your organization to multi-currency, some aspects of this feature that should be reviewed.The Multi-Currency functionality CANNOT be turned off once it is activated. Salesforce.com support team also recommends testing the activation in a Sandbox environment. The process locks the org when turning on Multi Currency (preventing users from logging in), this can take 30 minutes or more depending on the size of the organization. After activate this feature on your organization, you will have a standard field called "CurrencyIsoCode" as picklist in ont only standard objects but also in custom objectsAnd You will have a place to manage your currencies in following path;Your Name-->Setup-->Administr…

Inline Editing in Visualforce page

Inline editing in Visualforce was introduced with the Spring'11. It has the ability to turn on inline editing within Visualforce, a handy bit of user friendliness which has been availability in the standard application interfaces for some time. Enabling inline editing is simple. My example is related with the Contact Standard object. But this feature will work with custom objects as well.
<apex:page standardController="Contact">
<apex:form >
<apex:pageBlock mode="inlineEdit">
<apex:pageBlockButtons >
<apex:commandButton action="{!edit}" id="editButton" value="Edit"/>
<apex:commandButton action="{!save}" id="saveButton" value="Save"/>
<apex:commandButton onclick="resetInlineEdit()" id="cancelButton" value="Cancel"/>
</apex:pageBlockButtons>
<apex:pageBlockSection >
<apex:outputField value="{!contact.lastn…

Save an attachment in APEX