Friday 21 April 2017

Http Callout from Java Script | Rest Callout from Visual Force Page without Apex Class

Sample Code 1:- 

    <script src="" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44="  crossorigin="anonymous"></script>
        function Callout()
            var JSONResponse = '';
            var JsonBody = '';
            JsonBody = '{Request Body}';
            console.log('--JsonBody ------->'+JsonBody );
            var xhr = new XMLHttpRequest();
  "POST", "END_POINT_URL", true);
            <!-- xhr.setRequestHeader("Authorization","Bearer {!AccessToken}" ); -->
            xhr.setRequestHeader("Content-type", "application/json;charset=UTF-8");
            xhr.setRequestHeader("Accept", "application/json");
            xhr.onload = function () 
                JSONResponse = xhr.responseText;
                console.log('--JSONResponse ------->'+xhr.responseText);
            setTimeout( function()
                    if(xhr.status == 404){                     
                    else if(xhr.status == 401){
                    else if(xhr.status == 500){
                    else if(xhr.status == 200)
                        obj1 = JSON.parse(JSONResponse );
                        for(var x=0;x< obj1.length;x++)
                            var singleEle = obj1[x];
                            console.log('--singleEle ------->'+singleEle );
             <apex:pageBlockButtons location="Top">
                <button type="button" onclick="Callout();" style="height:22px; width:150px" > 
     Make Callout 

Sample Code 2:-

<html ng-app="demo">
 <script src=""></script>
  angular.module('demo', [])
  .controller('Hello', function($scope, $http) 
   var req = {
     method: 'GET',
     url: 'END_POINT_URL',
     headers: {
       'Content-Type': 'application/json',
       'authorization':'Bearer TOKEN_VALUE'
     body:{'test body'}

   $http(req).then(function(response) {
      $scope.greeting =;

  <div ng-controller="Hello">
   <p>Content is {{greeting}}</p>

You May get below error
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at END_POINT_URL. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

Solution :- To resolve the issue you need to request external system to add Salesforce Base URL in CORS

Amit Chaudhary

Sunday 16 April 2017

Success Story of :- Fabrice Cathala

Welcome to my 9th Salesforce Success Story series. This series is focused on success story and to inspire/encourage new user/Developer. And why we should join our local Salesforce Developer/User group.

1) Your Job Title
Senior Salesforce Solution Architect

2) Your success Story    
I started my career in the world of data centres in 1994 and took the risk to change my path to CRM implementations in 2001. In 2005, I discovered cloud computing when deploying Salesforce at Symantec. Only then I realised that my career change had paid off.
I moved from a highly technical job (working at the operating system level) to a mix of technology and business (CRM). Salesforce fulfils the geek in me as much as giving me the satisfaction of delivering business solutions to happy customers. I could have stayed monitoring networks and controlling IT systems performance forever, but I follow my gut feeling, stick with it for five years before getting rewarded.
In March 2017 I was honoured to be awarded the title of Salesforce MVP joining a crowd of highly talented individuals.

Build your career path, believe in yourself and keep learning.   

3) Why we Should Join a Salesforce User/Developer Group

User groups are a great way to learn new Salesforce related topics that you may not need for your current project but will position you as "the expert" in your next project.
The ambience in the Salesforce #ohana events is always warm and welcoming. Networking becomes fun! After a little while,  attending a Salesforce meetup will turn into an excellent way to meet your friends from the ecosystem, chill-out still learns new Salesforce tricks.
I'm a co-organizer of the Thames Valley DUG in the UK, and I can tell you that we do spend quite a lot of time and energy hunting for the best speakers and researching which hot topics we should propose to our audience. 

Now, there's one user group in particular that I'd like to put under the spotlight and it's "Women In Tech" (#WIT). In most cases, these groups are welcoming men, and I'm begging you, if you're a man, please attend at least a couple of WIT meetup this year. It's going to open your mind to an old problem which now needs an urgent solution. I believe that men need to be part of the solution to unlocking STEM careers for women. Please attend WIT meetup and show your support for a start. Then try and figure out how you can help.

4) Advice for new Salesforce Developer

If the only tool you have is a hammer, it is tempting to treat everything as a nail. But you shouldn't. Although it's fun to code, your responsibility is to provide an enterprise-class solution to all business problems thrown at you. The most robust tool is not code but standard (declarative) features: they have been tested for years and are supported by Salesforce. Your code will always be less resilient than out-of-the-box capabilities.

For this reason, always think declarative first and programmatic second.  

5) Trailhead badges
105. I'm a ranger since last December; the #100club was one of my goals for 2016. I've slowed down since (only five badges in three months) but will restart soon at a more steady pace.
Follow Fabrice Cathala on:
Twitter :

If you want to share your Salesforce Success Story, Please feel free to drop me an email :- 


Amit Chaudhary

Sunday 9 April 2017

Salesforce Apex Hours:- Lightning Component Framework

Farmington Hill Salesforce Developer group / Salesforce Apex Hours organized another successful Online session/event on 8th April 2017, focusing on "Lightning Component Framework".

First of All I would like to thank to "Mohith Shrivastava" for great session and demo on "Lightning Component Framework".

Agenda :-
  • Introduction To Lightning Components
  • Difference between Lightning Components and Visualforce
  • Thinking in terms of Component Model
  • Basics of Lightning - Inside Bundle
  • Events - Discuss Application and Component Events

Speaker :- Mohith Shrivastava, Salesforce MVP.
Date :- Saturday, April 8, 2017 11:00 AM EST
Venue/Link :- Online on Goto meeting


Some Useful link for "Lightning Component Framework" 

Code Reference 

Please follow us on below pages/link for future session :-

Amit Chaudhary


Saturday 1 April 2017

Success Story of :- Jean-Michel Mougeolle

Welcome to my 8th Salesforce Success Story series. This series is focused on success story and to inspire/encourage new user/Developer. And why we should join our local Salesforce Developer/User group.

1) Your Job Title

[JMM] :- SharinPix CEO, French Touch Dreamin founder, Salesforce MVP, Paris User Group Leader

2) Your success Story   

[JMM ] :- I started as a developer in many startups several years ago, then moved as CIO of a company which had to redraw his IT system. We made this based on Salesforce and that’s where i started this great adventure.
Doing this in the second company i joined as CIO, we started to work on an internal App to manage images within Salesforce. We found out that it was a great product idea with no-one doing great job around this on the AppExchange.
That’s where we decided to create SharinPix and i started to lead this company.
At the same time, i was honored to be choosen as the very first French MVP.

Now i’m participating to many Dreamin event all around the world, talk at many of those as well and love the spirit of the community you can find there !

3) Why we Should Join a Salesforce User/Developer Group

[JMM ] :- Networking ! You’ll be able to learn from the technical point of view, of course, but you will meet awesome people that could give you great example of what they’ve achieved. Salesforce is full of Gems that you can easily miss because you didn’t thought on using it this way.
The UG and DUG are the best place to learn from this and finally learn how to make more with this fantastic plateform.

4) Advice for new Salesforce Developer
[JMM ] :- Learn a lot around Lightning Components, it’s a game changing there, i’m sure it will be really big in the next years and developers that i’ve work on this will be at a very exciting place !

5) Trailhead badges
[JMM ] :- I’m not a 100 Badger’s club member but i think that could happen one day… I’m convinced that Trailhead is key for everyone in the salesforce ecosystem and i’m trying my best to save time on my other duty to learn more there. Anyway, as a CEO it’s not always that easy to do so. Just wishing it will come soon with a better smartphone support, but i’ve heard that it could be the case shortly !

Follow Jean-Michel Mougeolle  on:
Twitter :
If you want to share your Salesforce Success Story, Please feel free to drop me an email :-


Amit Chaudhary