Accessing VF page in Canvas

Canvas Jul 6, 2015


I have returned with a new concept wherein we will add a VF page on chatter with canvas. Let's take an use case.

Whenever a new Idea is submitted to any user, It should be displayed on company's profile so that anyone can view/vote/demote it right there. This is a sample use case and there can be mutiple things that can be done on chatter using canvas.

To start, we will create a Connected App in which we will specify which application or page needs to be opened with canvas(VF page in this case) & where to put it(chatter feed in this case).

Connected App

Connected App

Whenever canvas loads, it posts a signed request to page/application. Now, VF page should handle this signed post request and should get the relevant information/parameters out of it.

For this, we will write a controller for the page that will handle body paramters of this signed post request. Usually, We get data in Base64Encoded string in 'signed_request' parameter. Data consists of three parts seperated by '.' wherein first consists of your client secret information for security, second consists of your actual data.

Decoding second part will give us all relevant information/parameters passed.

Below is working code:

Checkout my another post here for adding canvas to chatter feed items.

To know more about Canvas, go through this documentation.

Related Tags:

Canvas   VisualForce   ForceDotCom   Salesforce