Salesforce Lightning is the most recent version of Salesforce. If you're using Salesforce Classic, please see this article for corresponding instructions. Salesforce Classic is the older version of Salesforce. Salesforce Lightning is a fully updated interface that’s available at no cost for all Salesforce Classic users.
Follow the steps below to set up your Salesforce dashboard and get it up and running on our Webpage App.
Two-Factor Authentication:
If you have two-factor verification enabled on your Salesforce account, you will need to give the device approval to bypass this. If not, click here to skip to the next step.
The best way to get around this is by setting up an approved IP address on Salesforce, which means that as long as the Enplug device is connected to the wifi network with the approved IP address, it won't need to go through the two-step verification.
Different wifi networks have different ways of assigning IP addresses. It's best to confirm this with your IT team, but there are several different ways of getting the IP address that you'll assign to your device:
- Static IP: If your office is set up with one IP address for the entire office, this makes the process very simple. Simply type "IP" into Google, and it will display your IP address. You can also go to http://checkip.dyndns.org/, which returns your current IP address.
- Ranged IP address: If you have a range of IP addresses set up for your office, you'll need to contact your network administrator for this range.
- Dynamic IPs: If your Internet Service Provider (ISP) provides dynamic IPs, and you have two-factor verification enabled on Salesforce, unfortunately Enplug cannot bypass the two-factor identification. Please contact support for more information.
Once you find out the IP address that you'll use, you'll need to set up Salesforce to allow devices on that IP address to access your Salesforce dashboard.
- In the top left corner of your Salesforce page, click "Setup Home".
- Navigate to "Security/Network Access" and click on "New" to add a trusted IP address.
If you have a Static IP for your office, enter this as both start and end.
Alternately, if you have a range of IP addresses, enter the minimum as the Start IP Address, and the highest as the End IP Address.
Salesforce Dashboard Link
Open the Salesforce dashboard you'd like to show on your Enplug device, and copy the URL directly from your browser. It should look something like this: https://na30.lightning.force.com/one/one.app#/sObject/01Z36000000nUOyEAM/view?t=1467043528112
Add Salesforce to your Enplug Dashboard
1. Go to the Apps dropdown in the upper left corner of the Enplug dashboard, and select the Webpage app.
2. Click "Add Website" in the upper right.
3. Enter the URL you just copied into the "URL" field. Choose whatever name and duration you prefer.
4. Click "Advanced Settings". Fill in the following fields:
- Website Appearance: Desktop View
- Page rendering delay: 2
- Reload each time page is shown (should be checked)
- Auto-Reload: 10
- Scale text: 100
5. Scroll down to the Javascript Settings section. Fill in your username and password as shown below.
6. Finally, copy & paste the below Javascript into the text field. This will format the Salesforce dashboard so that it doesn't show the sidebar and navigation bar, zooming in on your KPI graphs instead:
(function() { if ( document ) { try { document.getElementById('username').value = webView.getUsername(); document.getElementById('password').value = webView.getPassword(); document.getElementById('rememberUn').checked = true; document.getElementById('Login').click() } catch(error){} var frames = document.getElementsByTagName('iframe'); for (var i in frames) { if ( frames[i].src && frames[i].src.split('com/desktopDashboards/dashboardApp.app').length > 1 ) { var frame = frames[i]; document.body.innerHTML = ''; document.body.appendChild(frame); frame.style.position = 'absolute'; frame.style.width = '100%'; frame.style.height = '110%'; frame.style.transform = 'translate3d( 0, -10%, 0)'; return; } } } setTimeout(arguments.callee, 500); })();
Tips and Tricks:
1. Notice this line of code:
frame.style.transform = 'translate3d( 0, -10%, 0)';
Depending on your screen orientation, you may want to modify this value in order to hide the dashboard header out of the screen. For landscape screens a value -10% works fine while -5% works best for portrait screens.
2. When running the Salesforce dashboard for the very first time, the script may fail and display a blank screen. This happens because the script needs to log into the Salesforce system. Simply press save again and the page should reload just fine and work reliably from this point forward.
3. If you would like your webpage content to auto refresh and it does not work using the browser cache settings, use this JavaScript:
function login() {
try {
document.getElementById('username').value = webView.getUsername();
document.getElementById('password').value = webView.getPassword();
document.getElementById('rememberUn').checked = true;
document.getElementById('Login').click();
} catch (e) { }
}
function getElement(target, selector, name) {
return new Promise(function (resolve) {
function check() {
var el = target.querySelector(selector);
if (el) { resolve(el); }
else { setTimeout(check, 500); }
};
check();
});
}
function repositionFrame() {
try {
var frame = document.querySelector('iframe[src*="com/desktopDashboards/dashboardApp.app"]');
if (!frame) { return; }
frame.onload = function () {
runAutorefresh();
};
document.body.innerHTML = '';
document.body.appendChild(frame);
frame.style.position = 'absolute';
frame.style.width = '100%';
frame.style.height = '110%';
frame.style.transform = 'translate3d( 0, -10%, 0)';
} catch (e) { }
}
function runAutorefresh() {
try {
var frame = document.querySelector('iframe');
if (!frame) { return; }
var innerDoc = frame.contentDocument || frame.contentWindow.document;
getElement(innerDoc, '.refresh').then(function (trigger) {
if (triggerSet) { return; }
triggerSet = true;
setInterval(function () { trigger.click(); }, 60000);
});
} catch (e) { }
}
var triggerSet = false;
function run() {
login();
repositionFrame();
runAutorefresh();
}
function checkReady() {
if (document) { run(); }
else { setTimeout(checkReady, 500); }
}
(function () { checkReady(); })();