Thursday, May 17, 2012

Force.com Summer'12 Features

There are some Awesome features coming up in Summer'12 release. This is one release for which every force.com developer is waiting. Some of the interesting features listed below. I can't wait to lay my hands on these and test them....Phew!

Apex Describe Support for Field Sets
Visualforce dynamic bindings have supported field sets for some time. In Summer ’12, Apex provides describe support
for field sets, which makes it possible to dynamically generate the SOQL necessary to load all fields in a field set. This
makes field sets easier to use in Visualforce pages that use custom controllers.
This sample uses Schema.FieldSet and Schema.FieldSetMember methods to dynamically get all the fields in the
Dimensions field set for the Merchandise custom object. The list of fields is then used to construct a SOQL query that
ensures those fields are available for display. The Visualforce page uses this class as its controller.

Single View State—Generally Available
The Single View State optimization introduced as a pilot feature in Spring ’12 is generally available in Summer ’12.
Single View State will be activated on existing organizations within 24 hours of deployment of Summer ’12 on your
Salesforce instance.

JavaScript Remoting Enhancements
We’ve enhanced JavaScript remoting in several ways.
To make it easier to work with namespaces, especially for pages that make remoting calls to methods provided in packages,
you can use the $RemoteAction global to automatically resolve the correct namespace, if any, for your remote action.
To use this facility, you must explicitly invoke JavaScript remoting. The pattern for doing this is:
Visualforce.remoting.Manager.invokeAction(
'fully_qualified_remote_action',
invocation_parameters
);

There are lot of other features like

JSON Parser
New Types 
Sorting Support for Non-Primitive Data Types in Lists
Knowledge Management Publishing Service Class
Describe Support for Field Sets
New Interfaces and Methods for Running Apex on Package Install/Upgrade and Uninstall
Allow Reparenting Option in Master-Detail Relationship Definitions
New Lookup Relationship Options etc..

You can get the release notes from here Salesforce Summer'12 Release Notes


Wednesday, May 16, 2012

Dynamic Visualforce Components Explained


Some or the other time you might have faced a challenge of dynamically generating input fields. Most of the time we sticked to dynamic HTML and embed that in our VF page to fulfil our needs.

But now, Salesforce has introduced the new Dynamic visualforce components which means you no longer will be dependent on dynamic HTML for most of your needs.

Here is a sample which shows you how to generate a dynamic input form for Account object.

Page
<apex:page standardController="Account" extensions="DynamicInputForm">
<!-- Create section header dynamically -->
<apex:dynamicComponent componentValue="{!SH}"/>
<apex:form >
<!-- Create dynamic input form for account object -->
<apex:dynamicComponent componentValue="{!ActForm}"/>
</apex:form>
</apex:page>

Class
public with sharing class DynamicInputForm
{
    public DynamicInputForm(Apexpages.standardController ctlr)
    {
        //constructor code goes here
    }

  
    //Create a page block dynamically
    public Component.Apex.PageBlock getActForm()
    {
        Component.Apex.PageBlock pb = new Component.Apex.PageBlock();
      
        //creating an input field dynamically
        Component.Apex.InputField name = new Component.Apex.InputField();
        name.expressions.value = '{!Account.Name}';
        name.id = 'name';
        Component.Apex.OutputLabel label = new Component.Apex.OutputLabel();
        label.value = 'Name';
        label.for = 'name';
        //Use the above block to create other input fields
      
        Component.Apex.CommandButton save = new Component.Apex.CommandButton();
        save.value = 'Save';
        save.expressions.action = '{!Save}';


        pb.childComponents.add(label);
        pb.childComponents.add(name);
        pb.childComponents.add(save);
        return pb;
    }

  
    //create section header dynamically
    public Component.Apex.SectionHeader getSH()
    {
        Component.Apex.SectionHeader sh = new Component.Apex.SectionHeader();
        sh.title = 'Create Account';
        return sh;
    }
}
Updated Visualforce developer guide covers this topic.

Monday, January 16, 2012

Force.com Spring'12 Release Feature Set


Apex REST Updates

We’ve streamlined Apex REST and made it even easier to develop your custom endpoint. The following changes have been made to Apex REST API:
  • Apex REST automatically provides the REST request and response in your Apex REST methods via a static RestContext object. You no longer need to declare a RestRequest or RestResponse parameter in your method.
  • User-defined types are now allowed as Apex REST parameter types.
  • Apex REST methods are now supported in managed and unmanaged packages.
  • The order of elements in the JSON or XML response data no longer has to match the Apex REST method parameter order.

Concurrent Apex Jobs

Salesforce has increased the limit for the total number of Apex classes that you can schedule concurrently to 25 (the previous limit was 10). With this higher limit, you can now schedule more Apex jobs for concurrent execution.

ContentDocument Triggers

You can now associate Apex triggers with the ContentDocument object. You can create Apex triggers for the ContentDocument object only through the Metadata API. Alternatively, you can create the triggers using the Force.com IDE or the Force.com Migration Tool, both of which make use of the Metadata API.

OFFSET added to SOQL (Pilot)
We’re adding a new clause to SOQL which will allow your app to view records after a certain offset. Use OFFSET to specify the starting row offset into the result set returned by your query.
Using OFFSET is helpful for paging into large result sets, in scenarios where you need to quickly jump to a particular subset of the entire results. For example, the following SOQL query returns a result set that skips the first 100 rows of the full query results:
SELECT Name FROM Merchandise__c WHERE Price__c > 5.0 ORDER BY Name LIMIT 50 OFFSET 100
The resulting set of records would still be limited by 50, but would begin with the 101st record in the result set.
This feature is in Developer Preview. Please contact Salesforce.com to enable it.


Sunday, August 7, 2011

How Force.com is revitalizing Application Development?

The other day I caught up with an old friend. We spent about 5 years together, working on Microsoft technologies and developing a slew of applications. Invariably, the topic veered towards technology and application development. I asked him what he was up to, and discovered that he was part of a team working on an application for a large enterprise. Some of the features read like this...

(No "ideas" were shared, these are pretty common features of all apps!)

--- Data model that supports related records
--- Large scale Business validations on forms
--- A Facebook clone for the social connect
--- Approval mechanisms, Notifications, Security, etc.

He was going on and on, so I stopped him to ask what his role in the entire exercise was and how they were planning for future versions. I learnt that he was a Lead Developer for one of the modules at one of the locations. Incidentally, the project was being worked on from four different geographies each of them sharing a significant Development piece. They were yet to come up with the first version and the project has been running for 15 months. As for the cost, your guess is better than his!

I said wow! This sounded familiar, but hang on, what are we building here? An aircraft carrier?

My heart goes out to the CIO and the end users of the application. By the time they get to realize any value out of the applications, their priorities in life would have changed. And it must have been one hell of a CFO to have approved the budget in the middle of uncertain and trying times.

OK, let's get pragmatic to understand the reason for my frustration.
(Disclaimer: I've been a fan of the Force.com platform since it's inception, and have partnered in building a Company around it, but that's after working on Microsoft technologies for many years before that, and I am still a keen follower)

Traditional Application Development follows an approach similar to this:
Code, Test, Assemble, Bundle, Deploy, Resolve, Release, Fix
This is characteristic of any technology that forces Developers to interact with libraries and have them worry about making the code work after writing it. But, as Application Development evolved in general and the way Force.com has adapted in particular, this approach has become redundant. And, here's why.

We hear it all the time - Application Developers must focus on Innovation. But, Force.com is the front runner,  if not the only technology that lets Application Developers do that. Everything else is what's called as plumbing code. So, when you do any of the following (and more), you are essentially plumbing your code.

--- Write code (or use Design mode in IDEs) for Data validations, and even common Business validations
--- Importing libraries and fretting over getting all the files in one folder to ward of the "Assembly not found" error
--- Use multiple frameworks to imitate a 3-tier architecture, making your code bulky
--- Write classes for Notifications, Messaging, Role hierarchy, etc.
--- Move from one Remote m/c to another to deploy your code before seeing your page go bust with an Invalid reference error

Sample this - how can you expect your Developer to be innovative if he is plumbing for 75% of his time?
This is exactly where Force.com wins - with Visualforce, Apex and the Force.com platform, it helps Application Developers ideate. They get a Zen like feeling. It's the holy grail of Application Development platforms.

How does Force.com achieve this? I'll cover that in detail over the next few posts, but for starters, the crux lies in how the platform provides for a combination of common feature sets bundled with an exciting user experience, and how Developers are able to leverage a Business data model with easy to build validations and formulae through clicks. As a Developer, that's making it available on a platter for me! My interest to ideate is enhanced when I look at what I already have on Force.com. There can't be a better motivation to build great apps.

I can't but mention about the social connection, and how Business and Enterprise apps have the social toolbox ready to go on Chatter.

It is not all about the plumbing though, its how you have a wonderful user experience that makes it graceful that adds all the value. There are umpteen stories of how CEOs have built up the entire environment on Force.com leaving only the code for the Developers, which is essentially about 20-25% of the entire effort.

The technology industry has been known to fade out geographical barriers, but are the IT behemoths doing it in the most efficient way for their Clients? No. 3-year, 5-year budget cycles spread over millions of dollars cannot be a sustainable approach for a technological implementation. Bordering uncertain times, CIOs must demand the best approach, the best technology and the best ROI and must leave behind the baggage of legacy brands.
In the next post, I'll write about how Force.com dilutes geographical barriers in the best possible way, thereby letting in more of the innovation in to your apps.








Tuesday, May 3, 2011

Salesforce Easy vCard

We are launching a free application on appExchange for vCard downloads from Leads, Contacts, Accounts and Users.
You can download multiple vCards as well by PDF.. Stay tuned..
Here is the appExchange URL for Easy vCard.


Thanks,
Srinivas.





Thursday, December 2, 2010

Update Namespace Prefix in Your Apex Code

As a developer, it is sometimes very tedious when we have to make all of our code as a Managed Package. Have to go to each custom field/Object in the code and change it manually with the Namespace Prefix.

I have developed a tool which takes input as your Class/VF Page/Trigger etc.. for that matter any of the file type mxml, aspx, php etc... and gives the updated output like in the screen shots below.




 'Hope this helps

You can use the tool from here.

Thanks,
Srinivas.

Monday, June 14, 2010

Our App to Chatter Developer Challenge

Sorry People,

Its been a while I have updated the blog. I am coming up with some good articles in the near future. Meantime, We have submitted a simple application to Salesforce Chatter Developer Challenge. Check this out here and vote if you like it.

http://developer.force.com/chatterdevchallenge/entry?id=087300000002lGAAAY
entry is submitted by our Technology Architect Mr Rohit Marathe

Thanks,
Srinivas
www.trekbin.com