Friday, August 15, 2014

Calling APEX Rest service using Postman

This post explains the setup of Postman REST Client.  Postman REST client is an add-on for chrome that can connect to Salesforce using OAUTH 2.0 password flow.  Using this method, you can get the access token to call your APEX rest service.  

This topic assumes that you already have Postman REST client.  In case you don't have Postman REST Client, you can download from Chrome Store

Setting up OAUTH

Open Postman and click on new Collection to create a new collection.  Then enter the collection name as shown in below

Click on Create to create a new collection.  This will create a new collection

Now, we are ready to get the access token from Salesforce using OAUTH.  Enter the Authentication URL to salesforce under Normal Settings of the Postman.  For Sandbox the Authentication URL is and for production it is

Then select form-data is a method of POST to salesforce.  The following key value paris are necessary to post the authentication information to Salesforce.  

  •  grant_type=password
  • client_id=<clientId>
  • client_secret=<clientSecret>
  • username=<username>
  • password=<password>
The values for <clientId> and <clientSecret> need to be configured as an OAUTH application in Salesforce.  For more information on the setting up app access, refer to sale force documentation here..  Save the script.  You have the script read.  Now, add the script to the collection you have just created, by selecting "Add to Collection" button.

To get the access token, click on the "Send" button to get the send the authentication request.  If the user name, password, client id, client secret is correct, salesforce will return a JSON structure that contains access token.

You can now use this access token in the Request header to process calls in Salesforce.

  • Crete a new service by cloning the existing OAUTH service. 
  •  Change the URL to your apex service.  The format of the URL will be:  <instance_name>/services/apexrest/<servicename>/<version>  In this example we will us helloWorld Service.  so the instance url will be <instance_name>/services/apexrest/helloWorld/
  • Create a new Header Authorization parameter that has the access_token from the previous step.
  • Set the Content-Type as 'application/json'
  • Enter the JSON message in the Body to be submitted to Salesforce

The sample call to helloWorld Service in Salesforce is shown in screen capture below.  This service uses HTTP POST to post the message and the service responds back with the helloWorld in the respective language.

Now you can test your web services by click of a button.  Happy development!

Thursday, June 13, 2013

Salesforce Communities Replaces Portals

Salesforce recently announced that Salesforce Communities will be replace Customer Portal and Partner Portal.  This would be great for the customers who currently can't get all the juice out of portals.  For some-time now (4 months), I have been playing around and using communities during the pilot and think that Salesforce finally found a way to make Portals as a true "social" platform for Salesforce's users to communicate with its customers and partners.  I believe there are several advantages for Salesforce communities to switch to the communities if they are already using Customer or Partner Portals. The current customers can readily take advantages for 
  • Chatter:  I have seen most of the times when customers hear about Customer or Partner portals, they ask if Chatter can be used.  With Customer/Partner Communities, this feature is available OOTB
  • Use of Permission Sets:  If you have used Permission Sets in Salesforce, you would love this features.  You can use profiles and permission sets to configure access to Salesforce objects and resources
  • Better Branding:  The branding of communities goes all the way from look and feel to email templates and also chatter.  Currently branding of portals (unless some serious customizations) is awful and needs some serious TLC. With communities, the look is somewhat similar to internal uses see and als the branding can really customized easily.  This will make the interface consistant with rest of Salesforce
  • Better Login & forgot password functionality:  No need to configure Sites which will make the login more simpler.  The forgot password functionality will be similar to how currently sends out an email to uses to reset password.  In the customer portal, the email was sent out temporary password.  With Communities, this security hole is fixed, which means also reduces the need to write custom password reset functionality if you are too serious about sending user name and temp. password in the same email.
I'll add more features and "how-to" in future blogs.

Thursday, May 16, 2013

Version problems with Salesforce Lists and Ext.Js

Have you ever wondered, once you use javascript in your left side bar in Salesforce, your list pages just hang and see the ever ubiquitous, spinning wheel?
Well, today I have encountered this as we have been rolling out are beta release of a Appexchange product.

The issue is that when you are using Ext.JS for any development and JavaScripting, make sure that those are compatible with Salesforce Ext.JS libraries.  Otherwise, you will run into JavaScript version libary problems and Salesforce Lists will just not work.  Salesforce Lists usings Ext.JS libraries to pull the lists and this causes all the trouble

Monday, May 13, 2013

Leading Big Vision from Heart

I've borrowed this title Stanford University's Leadership series podcast from Justin Rosenstein  of Asana.  Everyone should hear this podcast to see how a small startup is able to lead a change in organizations to share resources and become more collaborative in solving complex problems.

We so often forget in daily pony-and-dog-show by leaders that how important it is for the employees to focus on vision of the organization.  It is primary job of the leaders to ensure that every decision taken by them are small steps is towards that vision.  This will enable employees who serve the customers understand how they can forward that greater vision.  While many may see this is all "text book" speak and does not happen in organizations  I would call as BS.  I had the privilege of working with some true leaders in their capacity who have followed the principle of leading through big vision and I'm very grateful for them for mentoring me.

The basic responsibility of a leader is to make sure, they let the employees understand the goal and purpose.  The leader is the captain of the ship. An organization may have performed well in the past and in near term, but without a goal and purpose, it is like a drunk captain who is enjoying the catch (s)he just had caught and not worried of the storms in the horizon.   The employees too will ignore what is in the horizon and just enjoy the party on-board, and think who caution on the impending storm are just people who don't understand how to party.  In these cases, the captain of the ship who does not take any responsibility and is happy to maintain the status-quo only to see in few years, they will be like 100s of organization buried by the storm on "change".

In this every changing world, technology is enabling competition a small 5 people company to compete with a large corporate.  The same technology if not adopted quickly is risking companies(For Example BMC Software) to go out of business is a telling tale of how leaders can really screw-up organization and employees from having a leaner, open and collaborative environments.

Sunday, April 14, 2013

Google's changing focus

Recently Google announced that it is pulling the plug on Google Reader on July 1st 2013.  It was a weird feeling I was reading about this in Google Reader itself.  I've been using Google Reader since past 4 years regularly.  I feel this is one tool that Google has produced that is simple, easy to use and meets the needs.

From Google's perspective I totally get it why they want to go away from Google Reader.

  • It is not an effective advertising revenue generator
  • Is not as "Social" as Google+
  • Standalone product and does not integrate with other Google's ecosystem 
  • Does not serve Google's enterprise push:  Google's focus is not on its enterprise than regular common users as its add revenue has reached a crest

Monday, February 4, 2013

Apex Mobile User License Explained

Last week, I was looking at the org. license details of one of our customers who wanted to see if they can use the mobile license.  They did not have mobile licenses or purchased any.  While looking Company Profile section of the Setup, I found that they had "Apex Mobile User" Licenses.  As this does not explain the difference between "Apex Mobile User" and "Salesforce Mobile" licenses, I contacted Salesforce and got a very clear and conscience explanation of these different type licenses

Apparently I was informed by SFDC that "Apex Mobile User" and "Salesforce Mobile" licenses are the one and same.  Apex Mobile User License have full support of mobile features of Salesforce.  This license can work on Visualforce, Page Layouts, Standard or Custom object of Salesforce.  Each users will have to enabled explicitly to enable them for mobile devices.

So, now that the customer has Apex Mobile licenses, their team can leverage these features.