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

Tuesday, May 11, 2010

Interfaces for Apex Class - Salesforce

Implementing Interfaces for Apex Classes

An interface is like a class in which none of the methods have been implemented, the method signatures are there, but the body of each method is empty. To use an interface, another class must implement it by providing a body for all of the methods contained in the interface.

public class InterfaceClass
{
    //Lets consider a Bank trnasaction interface which indeed used by 3 banks BankA, BankB and BankC
    public Interface bankTransactionInterface
    {
        double deposit();
        double withdrawal();
   }
    
    //We have to implement the two methods declared in the interface for BankA
    public class BankA implements bankTransactionInterface
    {
        public double deposit()
        {
            //process the deposit
            double depositedAmount = 250;
            return depositedAmount ;
        }
        
        public double withdrawal()
        {
            //process the withdrawal
            double withdrawalAmount = 350;
            return withdrawalAmount ;
        }
       
    }
    
    //We will take another class for BankB and declare it as virtual as it is parent of BankC which has different deposit porcess but same withdrawal process as BankB.
    //For this we have to declare the deposit method as virtual and use override keyword when overriding it for BankC like showed below
    public virtual class BankB implements bankTransactionInterface
    {
        public virtual double deposit()
        {
            //process the deposit
            double depositedAmount = 450;
            return depositedAmount ;
        }
        
        public double withdrawal()
        {
            //process the withdrawal
            double withdrawalAmount = 1000;
            return withdrawalAmount ;
        }
    }
    
    public class BankC extends BankB 
    {
        public override double deposit()
        {
            //process the deposit
            double depositedAmount = 750;
            return depositedAmount ;
        }
    }
} 
'Hope this is helpful 

Thursday, May 6, 2010

Salesforce.com Customization Questions

Salesforce.com General/Customization Questions

As I am getting requests from people to post more questions on customization also. I am posting here questions in a more general way.
With this you will get a good idea on basics of salesforce.com usage.
1. Explain how MVC architechture fit for Salesforce
2. How will you create relationships between objects
3. How many types of relationships are possible on objects
4. How many data types are supported for a Custom Object Standard Field Name
5. What are activities
6. What is the difference between Task and Event
7. List and describe the features used to set permission and data access in a custom app.
8. How will you create a User
9. What are the available editions of salesforce.
10. What is the difference between Enterprise/Professional/Unlimited/force.com/Developer editions.
11. What are Sharing Settings
12. What are Person Accounts
13. How forecasting works in salesforce
14. What are the system fields. Can you name some of them
15. What are the default components available on home page?
16. How do I change the home page layout?
17. How many types of Reports I can create in salesforce. what are they
18. What is dashboard. How it is created
19. What is Page Layout
20. What is the Related List
21. What is the difference between Page Layout and Related List
22. What is mini page lay out

As I am in hurry, I will update this post with real taste of customization questions as soon as I can.

Hope this is helpful.

Thanks
Srinivas,
Technology Evangelist,
Trekbin Technologies,
www.trekbin.com

Wednesday, May 5, 2010

Visualforce Email Template with Attachment

Visualforce Email Templates with Component as Attachment

Now Email templates can be created through a visualforce. That is you can send emails to people with salesforce features.

I will explain a Visualforce email template basic/as well as with component as attachement here.

<messaging:emailTemplate recipientType="Contact" relatedToType="Account" subject="opportunity report for Account : {!relatedTo.name}">
<messaging:htmlEmailBody >
<html>
<body>
<table >
    <tr>
        <th> Name </th>
        <th> CloseDate </th>
        <th> Stage Name </th>
    </tr>
    <apex:repeat var="o" value="{!relatedTo.Opportunities}">
        <tr>
           <td>{!o.Name}</td>
           <td>{!o.CloseDate}</td>
           <td>{!o.StageName}</td>
        </tr>
    </apex:repeat>    
</table>
   
</body>
</html>
</messaging:htmlEmailBody>
</messaging:emailTemplate>
The above Visualforce Template sends out all the opportunities that are related to the Contact's Account.

The one more powerful usage of Visualforce Email Template is We can introduce Custom Components in the body.

I would like to attach a PDF document which shows the number of Opporutnities for that account grouping by their close date. This I can do in a component and include that component inside my email template like this after htmlEmailBody tag.
<messaging:attachment renderAs="PDF">
    <c:opportunityGrouping accountId="{!relatedTo.Id}"/>
</messaging:attachment>
component:
<apex:component controller="opportunityGroupingController" access="global">
    <apex:attribute name="accountId" assignTo="{!accId}" type="String" description="Id of the account"/>
    <table >
            <tr>
                <th> Total </th>
                <th> CloseDate </th>
            </tr>
        <apex:repeat var="opp" value="{!GroupedOpportunites}">
            <tr>
                <td>{!opp.Total}</td>
                <td>{!opp.CloseDate}</td>
            </tr>
        </apex:repeat>    
    </table>
</apex:component>
opportunityGroupingController Class:
public class opportunityGroupingController 
{
    public String accId
    {   get;set;    }
   
    public list<AggregateResult> lstAR = new list<AggregateResult>();
   
    public list<subClass> lstSC = new list<subClass>(); 

    public class subClass
    {
        public Integer Total
        {   get;set;    }

        public date closeDate
        {   get;set;    }
       
        public subClass(AggregateResult ar)
        {
            Total = (Integer)ar.get('Total');
            closeDate = (date)ar.get('CloseDate');              
        }
    }

    public list<subClass> getGroupedOpportunites()
    {  
        lstAR = [select count(Id) Total, CloseDate from Opportunity where AccountId =:accId Group By CloseDate];
        for(Integer i = 0; i < lstAR.size(); i++)
        {
            subClass objSubClass = new subClass(lstAR[i]);
            lstSC.add(objSubClass);
        }
        return lstSC;  
    }
}

Hope this is useful.

Thanks
Srinivas
Technology Evangelist
Trekbin Technologies