Wednesday, August 5, 2015

[Salesforce / Revamp] Enable All Trusted IP Ranges for a Salesforce Org



DISCLAIMER: I've just understood you can do this on the profile (without range restrictions). See the "UPDATE" section of this post. This post is still valid as exercise.

Enabling all trusted IP ranges is a must do when developing on a Salesforce Developer ORG and you want to access via metadata API to your code from different locations where your IP can change during time (home, bar, pub, pizza shop, your parent's house, your parent's in law house, ...).

Thanks to Ray Dehler Enable All Trusted IP Ranges, I've done it several times in all Developer ORGs I've created since 2011...BTW thanks Ray, you saved me a lot of time!

Unfortunately with Summer '15 Release this awesome home page component does not work anymore: all home page components that use Javascript cannot work anymore, the Javascript code is blocked and you are forced to use a Visual Force page if you want dynamic behavior.

Apparently it is impossibile to reproduce this home page component using a Visual Force page, these are the main limitations I found while trying to update Ray's component:
  1. When using a Visual Force home page component with the same Javascript code, Salesforce reloads the loaded "Network Access" component of the iframe on the "parent" location, making it impossibile to load all iframes in one shot
  2. If you use the Visual Force outside the custom component (i.e. loading "/apex/PageName"), due to cross domain restrictions, the iframe is not loaded
  3. Even if you managed to load all iframes on point #1, the corss-domain restriction block you from loading the iframe's HTML content

Apparently this is impossibile to make it work same as old days.

That's why I created a simple update of the component to help adding (manually) all ranges:


Click on each "Click to load range" link to open, in a separate window, the "Network Access" page in Edit mode.

This is a way to help developers to load trusted range IPs, faster than writing all ranges by hand.

You can install this unmanaged package clicking on the following button:



Or by installing the following unmanaged package.

This is the GitHub repository with the code and other infos.

If you have a better solution / automation, please share!


UPDATE: I admit, I feel so dumb, but you can simply add the 0.0.0.0-255.255.255.255 range in your Profile (no restrictions apply there), following this section: