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

A sandbox is basically a replication of your Salesforce org you can use for development , testing, and training without disrupting your production environment. Sandboxes are completely isolated from your Salesforce production organization, so anything you do in your sandboxes will not affect your Salesforce production application, and vice-versa. Sandbox provides a set of tools that deliver real, tangible business benefits and it’s not just for developers. If you make a mess of things, your “real” data and org is protected and your sandbox can be refreshed 29 days from its creation or from the last refresh. You can be created a sandbox in production environment; Setup > Administration Setup > Data Management > Sandbox There are three types of sandboxes available to Salesforce.com customers. Configuration-only sandbox Configuration-only sandboxes copy all your production organization’s reports, dashboards, price books, products, apps, and customizations, but exclu

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: [<namespace>.]<controller>.<method>([params...,] <callbackFunction>(result, event) { // callback function logic }, {escape:true}); namespace is your organization's namespace. This is only required if the class comes from an installed packaged. controller is the name of your Apex controller method is the name of the Apex method you're calling params is the comma–separated list of parameters that your method takes callbackFunction is the name of the function that handles the response from the controller. It returns the status of the call and the method result. escape defines whether your response should be escaped (by defau

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

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 Administrator Prior 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 objects And You will have a place to manage your currencies in following path; Your Name-->Setup-->Admi

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="{!cont

Save an attachment in APEX

Attachment field allows users to be able to attach notes and attachments to custom object records. This allows you to attach external documents to any object record, in much the same way that you can add a PDF or photo as an attachment to an email. This option is only available when you are creating a new object. Here I have an example for save an attachment in APEX. /*****Controler*****/ public class status{ private final Applicant__c applicant; public Blob resume {get; set;} public String contentType {get; set;} public String fileName {get; set;} public status(ApexPages.StandardController stdController) { this.applicant=(Applicant__c)stdController.getRecord(); } public PageReference saveApplication() { try{ insert(applicant); }catch(System.DMLException e){ ApexPages.addMessages(e); return null; } if(resume!=null){ Attachment attach=new Attachment(); attach.Body=resume; attach.Name=filename; a