Tuesday, August 21, 2018

Installing Salesforce Workbench locally on OS X

I just love Workbench, even though officially it's in foster care by Salesforce at best.  The Swiss army knife-like tool is light, intuitive, and packed with a lot of features.  You can use it online, but for security/compliance or other reasons, you may wish to use it on premise.  If there isn't a computer/VM somewhere you can easily install it on, running it from your laptop is not a bad choice either.  On a Windows computer, that usually involves installing an easy AMP stack like xampp, and that's that (IIS + PHP is fine too if you like).  With OS X already bundled with Apache and PHP, there's no need for software install there, but some config is still needed, esp to get the HTTPS part right for Workbench.  So here's my step-by-step guide for the whole setup.  Most of the steps are done in Terminal, so all the italics are commands to run.

Enabling Apache

sudo su -
apachectl start 

Enabling PHP and SSL

PHP and SSL are needed to run a proper Workbench.  You'll need to edit Apache config file to enable the pieces needed by them.  I'm using nano here for editing but certainly feel free to use your beloved emacs or vi.

First back up the existing config file
cd /ect/apache2/
cp httpd.conf httpd.conf.backup 

Next edit the config file.
nano httpd.confUncomment the following lines for PHP and SSL
LoadModule php7_module libexec/apache2/libphp7.so
LoadModule socache_shmcb_module libexec/apache2/mod_socache_shmcb.so
LoadModule ssl_module libexec/apache2/mod_ssl.so

Include /private/etc/apache2/extra/httpd-ssl.conf

Save the config file and test it by running
apachectl configtest

Restart Apache
apachectl restart

You can test PHP by adding a really simple PHP page to the DocumentRoot (default is /Library/WebServer/Documents)

echo ' /Library/WebServer/Documents/phpinfo.php
Verify PHP by accessing http://localhost/phpinfo.php

Installing Workbench 

It can be copied to local hard drive by git.
git clone https://github.com/forceworkbench/forceworkbench
Then copy the folder workbench to Apache's DocumentRoot (default is /Library/WebServer/Documents)

Creating Self-Signed Certificate and Enable SSL with Apache

To use SSL with Workbench Apache will need a certificate configured and some configuration changes.  Here's a good guide that I don't need to retype here.   😀

Trusting the Cert

Setting up a Proper Server Name with TLS

 

References:

https://jason.pureconcepts.net/2016/09/install-apache-php-mysql-mac-os-x-sierra/

https://gist.github.com/jed/6147872

https://gist.github.com/nrollr/4daba07c67adcb30693e 

Tuesday, March 13, 2018

Where's my App Branding Image?

When configuring a Lightning app, you have the choice to upload a brand image so the app can show that on screen as icon/header.  The setup screen looks like this:




You can click on the image to upload a new one.  Notice that there's no name or location specified.  Do you wonder where it's stored?  If you were like me, you'd just say "doesn't matter, Salesforce handles it".  That's all good and nice, until... you need to deploy the shiny new app.  If you just include the CustomApplication in the package.xml, like any good developer would, an error like this would crop up.
applications/LightningSalesConsole.app -- Error: In field: logo - no ContentAsset named hack_Logo3kb2 found 

There's the image storage you never knew.  It's called ContentAsset, which you need to bring along with your deployment.  Simply include this in package.xml:
   


The question is, how do I find the ContentAsset name easily (without having to open up my .app file or waiting for the error)?