Sunday, January 22, 2012

Environment specific variables in SalesForce

If you are developing web-service callouts in development or sandbox and moving them to production, you have to manually change the properties of the out-bound webservices.  For example, you are developing a callout that updates the customer information to an external system when a new customer record is created in SalesForce in Sandbox.  After completing the testing of the callout, you would want to move your apex code to production org.  But, the end point, authentication details of the outbound service will be different than the one in test environments. 

Unfortunately, SalesForce doesn't provide the flexibility of configuration/property files that Java provides.  Luckily SalesForce now provides Custom Label functionality that can be used for this purpose.  
I normally define the endpoints, authentication details as custom labels in sandbox and production orgs.  The advantage is, 
  • the apex classes need not change from sandbox to production.  
  • The test cases run perfectly fine in sandbox and production orgs.  
  • When there is a change in environment specific property value, you need not create a change-set or migrate your code.  
  • Better Apex code development


To create custom labels
Setup->Create->Custom Labels

There are other way of externalizing the properties 

  • Create Properties__C object and store the properties.  The disadvantage of this approach is you are maintaining an object for properties and issuing SOQL queries to retrieve the properties.  
  • Using URLRewrite:  While this solves the purpose like the one mentioned above.  It involves find the parsing various formats of SalesForce's representation of the URLs, i.e.. different urls for internal users, portal users and sites users and you have to understand them
  • Page References:  Using page reference to get the url is limited by developing VF pages and would not address the purpose of this discussion
  • Get Organization ID:  Getting the org. id will also solve the purpose and you can determine based on the org. id which property to use.  But this can lead to issues when you have more than 2 orgs and also multiple outbound web-service environments

Monday, January 2, 2012

UMLet for UML diagrams

Last week, I was searching a free light weight UML software that I can use for doing some UML stuff for a design specification.  I found UMLet to be a cool tool that is easy to develop Activity, Component and Use Case Diagrams.  I can now do design and uml within minutes this tool.  Checkout at www.umlet.com.  


BTW, did I mention how painless it is use in eclipse too!!

Happy New Year 2012

Wishing you a very happy and prosperous 2012 ahead.  I got a chance to lay my hands on one of the best books I've read ever.  The title of the book is "I moved your cheese" by Deepak Malhotra.  This is a must read book if you have already read "Who moved my cheese" by Spencer Johnson.  

Deepak Malhotra brilliantly put forth the need to question the change which Spencer Johnson doesn't cover in the book.  I've loved reading WMMC in the last 9 years and everytime I read, find something new.  Now, I've IMYC an addition to WMMC. 

The best part I liked about the IMYC; it was short, to the point and the author did not dwell into what should the best steps to question change (Maze and Cheese).  Instead he used Max, Zed and Big to come up with their answers by looking at the maze.  Deepak Malhotra asked a series of questions that the reader can answer from their experiences and thoughts.  I would recommend as is a must read for every professional

Wednesday, December 28, 2011

Multiple Users for a contact in SalesForce Customer Portal

This article discusses about
  • Creating Multiple Users for the same contact in Customer Portal

While there is already an article on SalesForce wiki about creating a customer portal user, it doesn't address my case of creating users through a trigger instead of the visual force page.  Also, the user creation is not dependent on the contact creation but creation of a contact's child record.  Before I jump into the nuts and bolts of the things, let me give a background.  (Here I assume that you have an understanding of how single sign-on works.  SalesForce has a very good article describing single sign-on process in salesforce.  This article only deals with traditional SAML 2.0 federation authentication as salesforce supports only this type of authentication of Customer Portals.

Background
Recently, I came across an issue related to the single sign-on integration with salesforce.  The existing identity provider system identifies users by the subscription ids.  For example, if John Smith has three subscriptions (S100, S200 and S300), then John is identified by the IDP as a three users who have access to the system.  In SalesForce, we have created Subscriptions of Contact.  So, subscription details (start date, end date, payment, active/inactive, etc..) is the child of the Contact.  That means that we have cannot use subscription IDs to create users; as SFDC only allows one user per contact.  You cannot create multiple portal users for the same contact




Implementation
This implementation only addresses the test case and trigger that was developed as a proof of concept to show how we cannot create multiple portal users for the same contact


First we account and contact in the test case




Monday, November 28, 2011

Evaluating IaaS for Small and Medium Size companies Part 1

I've been spending some part of my last week evaluating Infrastructure as a Service companies to move my company servers onto the cloud.  Being a cloud services company it makes easier for us to move the infrastructure to the cloud.  There are several advantages to move the servers from in-house or remote management to the cloud.


1.  Less hassels managing the hardware
2.  Paying for the administrators to manage hardware
3.  Removes hassels of dealing with the ISP
4.  That is not my companies core competencies
5.  I pay only for the resources that I use and most of the times, I'm not utilizing resources 100%
6.  Makes the company more green and saves green bucks


I've used Gartner's magic quadrant to evaluate the Service provides.  I narrowed down to three for the ease of evaluation and also access to the service companies


1.  RackSpace
2.  Amazon Web Services EC2
3.  GoGrid


Total Cost:
I think Amazon has one of the best self-help documentations available among the IaaS.  The other thing I like about Amazon is their price structure.  It is standard and easier to understand and predict.  Compare these with anyone in this group and you would get a reply, talk to account manager or how about some free trail.      This just leads me to believe that I don't know the exact cost in next one, two or three years that I would incur when I'm moving my server infrastructure on your backbone.  I don't mean to say that this drives me away from other three wonderos.  But price is one of the drivers of moving from in-house to cloud.  Isn't it?


VPN, Private and Public Clouds:
To my surprise, Amazon doesn't have a good VPN, Private and Public Cloud services.  GoGrid and RackSpace both offer these services.  May be because, Amazon thinks that its too much of an hassel and also their customer base isn't asking them a lot yet.  Honestly for me this is a "good to have" currently, because we don't have plan to be in a mix of clouds.  Being a small company, it doesn't make sense to be working on multiple cloud offerings.  So for me this is a good to have feature so that in future when I need it I can make use of them


Managed and Self-managed cloud:
Since being a small company and servers not being a core competency, I was looking for a managed or some kind semi-managed.  GoGrid and Rackspace scored brownies here and Amazon was all about self-managed infrastructure.  So if I wanted to move to Amazon, I'd to spend some part of my time maintaing the infrastructure


Customer Service:
Customer Service from Amazon perspective is as good as its costs are.  Also, I think from the stand point of moving from moving ones infrastructure onto cloud, there is little an IaaS vendor would offer interms of Strategy.  The uptime and any backups are critical and all three vendors do a great job in uptime and guarantee. GoGrid offers 100% uptime.  


Licensing and Software Package:
I think in all Amazon had the best package in terms of licensing.  You can use ms-sql server licenses that you already have purchased to use them in AMIs.  Also I think there is some documentation that is involved between you and Microsoft regarding this.  Also, I've heard that GoGrid and RackSpace offer similar offerings but not tested them.  Also, I don't have clear picture on much money additional software costs on these machies compared to AWS AMIs.


Speed and Latency:
Amazon is the best in the industry interms of latency.  In east coast they have servers in Virginia (did I mention in Herndon?) which is great for someone is lives at a stone throw:).  Anyways, they have pretty good DCs located across the globe.  I think GoGrid and RackSpace have pretty good reach in North America.  But being a small business, currently, I am not looking for a reach across the globe.  So for me, all three are tie


Thought Leaders:
Amazon has been one of the key drivers in this space and have wide array of offerings.  RackSpace is surely an industry mover for IaaS and managed hosting.  GoGrid is a niche player for IaaS.  Again all these analysis is based on my evaluation of the three offerings and Gartner's magic quadrant.