No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Configure the Heroku Environment Variables
Now that we’ve created the canvas app, we need to
set up an environment variable for the consumer secret.
- From Setup, click .
- In the Connected Apps related list, click DeliveryTrakr.
- Next to the Consumer Secret field, click the link Click to reveal.
- Copy the consumer secret.
- Open a command window, navigate to the Delivery-Tracker-Java-App directory, and enter this command to create the environment variable: heroku config:add APP_SECRET='Your_Consumer_Secret'If you’re working from a Windows computer, you may need to replace the single quotes with double quotes (").
- Navigate to the Delivery-Tracker-Java-App\src\main\webapp\scripts directory.
- Open shipment.js in an editor. In
the onGetPayload function, replace
YOUR_APP_URL with the URL of your DeliveryTrakr app on Heroku: p.url = "https://[YOUR_APP_URL]/signed-request.jsp?shipment="
+ shipment;This code is located on or around line 231. Using our example, the line of code should look like:
1p.url = "https://deep-samurai-7923.herokuapp.com/ 2 signed-request.jsp? shipment=" + shipment; - Save the changes to shipment.js and navigate back to the Delivery-Tracker-Java-App directory.
- Enter this command: heroku
config:add RUNNING_ON_HEROKU='true'This specifies that the application is running on Heroku. This is helpful for testing so you don’t need to re-deploy every time you make a change. If you’re working from a Windows computer, you may need to replace the single quotes with double quotes (").
- Enter this command to get the file ready to commit: git add —A
- Enter this command to commit the changes along with a comment: git commit —m 'MyChangeComments'If you’re working from a Windows computer, you may need to replace the single quotes with double quotes (").
- Enter this command to deploy the app to Heroku: git push heroku masterIf the process completes successfully, you’ll see something like this:
1-----> Compiled slug size: 11.2MB 2-----> Launching... done, v6 3 http://deep-samurai-7923.herokuapp.com deployed to Heroku 4 5To git@heroku.com:deep-samurai-7923.git 6 * [new branch] master -> masterIf you receive a “permission denied” error message, you may need to set up your SSH key and add it to Heroku. See https://devcenter.heroku.com/articles/keys.
You can quickly test that the canvas app is working from Setup in the full Salesforce site by clicking Canvas App Previewer. Click the DeliveryTrakr link on the left, and you’ll see the Heroku application running in the previewer and displaying a list of shipments and their delivery status. Now we’ll create a global action for the canvas app so that your mobile users can starting using what you’ve created.