Troubleshooting Salesforce Variables
Last Updated March 29, 2021
Background
There are seven predefined Salesforce variables that WalkMe can identify in Salesforce (please note that for Salesforce Classic the WalkMe for Salesforce Package is NOT required for these to be available)
- walkme_sf_vars.organizationId
- walkme_sf_vars.organizationName
- walkme_sf_vars.profileId
- walkme_sf_vars.roleId
- walkme_sf_vars.userId
- walkme_sf_vars.userLanguage
- walkme_sf_vars.userName
Limitations
The following aren't available for use in Salesforce Lightning:
- walkme_sf_vars.organizationId
- walkme_sf_vars.organizationName
sfVars is not supported in Salesforce Lightning Communities.
Background and Deployment
- WalkMe for Salesforce Package (WM4SF): In addition to the setup done by WalkMe, we recommend that you deploy the WalkMe for Salesforce Package. This is MANDATORY for Salesforce Lightning. For Salesforce Classic, this will give the builder the ability to include Custom Salesforce Variables.
Troubleshooting sfVars
"walkme_sf_vars" is showing undefined...
Check the following for all platforms:
- Make sure to clear cache and cookies when testing updates or changes.
- Check for incorrectly formatted custom variables by doing the following:
- In the Editor > Settings > General > Salesforce Variable section
- Here you would want to check that the custom variable appears correctly formatted according to this KB
- Ensure that the proper syntax for the variable is used for example: walkme_sf_vars.profileId NOT WalkMe_Sf_Vars.ProfileID
Salesforce Classic
-
- Check that window.__sfdcSessionId is callable from the environment's console.
- If it returns "Not Defined" then this means the user does not have API permissions. Ask the Salesforce Admin to grant the relevant users API permissions in order to use sfVars
- You can find this setting in Salesforce by checking Setup > Security Controls > Session Settings > Require HttpOnly.
Salesforce Lightning
-
- First, check that the WM4SF package is deployed as this is a REQUIREMENT for Lightning implementations.
- Check for any incorrectly formatted custom variables per this KB
- If you see a console error like below this may mean the user does not have access to the sfVars VisualForce page.
- Check that the user has access to the WM sfVars Visual Force page. It will need to be available for all profiles that need to access WalkMe and the variable. To do this:
-
-
- Navigate to Setup
- Search for Visualforce Pages in the Quick Find and navigate to the page
- Go to V > vf_WalkMeSfVars and click Security
- Add all the Profiles to the Enabled Profiles on the right to enable sfVars for the user profile
-
-
- You can also check to see if there is a "walkme-sf-vars-last-fail" key in Local Storage
- Check that window.__sfdcSessionId is callable from the environment's console. If it returns "Not Defined" then this means the user does not have API permissions. Ask the Salesforce Administrator to grant the relevant users API permissions in order to use sfVars
- Check if calling document.cookie contains "sid=####" - if it does not, this most likely means that the customer has HTTPOnly enabled for their sessions. sfVars is unable to work with HTTPOnly because it makes the sid cookie invisible to our code.
- You can find this setting in Salesforce by checking Setup > Security Controls > Session Settings > Require HttpOnly.
Communities:
-
- Ensure the WM4SF package is deployed and the latest version.
- Check that the VisualForce page exists for the Community
- Make sure users have API enabled in Salesforce
Was this article helpful?
Yes
No
Thanks for your feedback!