2

I'm trying to create my very first canvas connected app in salesforce and I need help how to call that in visualforce page and I have setup creating connected app and also i have external app sample here in the github, my question is how to call the external app from visualforce page?

followed this blog and end-up in github

5

You will use apex:canvasApp tag on your visualforce markup

<apex:page controller="JSONGeneratorSample">
    <apex:canvasApp developerName="mycanvas" parameters="{!generateJSON}" />
</apex:page>

Note that you can either use Application Name or Developer Name .

Once your Visualforce page is rendered ,it will make a GET Request to the Canvas URL that you have in your connected application .

Unless you validate the Signed request sent ,Your page will display signed request failed .

The consumer Secret is the private key that can be used to validate the signed request .

Once the Signed request is validated ,you will get the Canvas Request Object .

enter image description here

The canvas Request Object will have the Parameters you have sent in parameters attribute in your visualforce page .

Also Canvas Request Object will have userinfo of salesforce and other details and Environment Variables .The sample Canvas Request will look like this

Once you have Environment variables and Signed Request token your page thats rendered from external server can make REST API calls to SFDC .

The Canvas Documentation provides examples of how you can execute these .

  • in the apex: tag you parameters="{!generateJSON}" what exactly are sending in as a parameters? – Nick Kahn Apr 27 '16 at 14:10
  • @NickKahn It will be your custom parameters .Its a key and value combination the external system – Mohith Shrivastava Apr 27 '16 at 17:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.