anusha(salesforce developer)

Thursday 11 August 2016

How to Whitelist All IPs in Salesforce

How to Whitelist All IPs in Salesforce

I saw this on many developer forums and stack exchange and many others are facing the same issue of how we can enable of all IPs in our organization. For developers this a big problem, as every-time you share the credentials with anyone you've to whitelist their IP so they can login without sending any security code to emails.

So here is sweet and short solution to it. You simply need to create a home page component (custom link) and use this code there :


var startingPoint = 0; 
var endpoint = 0; 

openPage(); 
function openPage() 
{ 
endpoint = startingPoint + 1; 
var win = window.open('https://ap2.salesforce.com/05G/e?IpStartAddress=' + startingPoint + '.0.0.0&IpEndAddress=' + endpoint + '.255.255.255&isdtp=vw',600,600); 
win.onload = function() 
{ 
win.document.getElementsByName('save')[0].click(); 
win.onunload = function() 
{ 
win.close(); 
startingPoint = startingPoint + 2; 
if(startingPoint <= 255) 
{ 
openPage(); 
} 
} 
} 
}


On home page layout you've to use this custom link. Make sure your browser is allowing the pop-ups as once you click on this link just sit back and relax as it will continuously calls the page and add IPs to your org.

Also in code I've "https://ap2.salesforce.com", please make sure you change it your base URL of the ORG (rest URL remain as is "/05G/e?IpStartAddress=' + startingPoint + '.0.0.0&IpEndAddress=' + endpoint + '.255.255.255&isdtp=vw',600,600")

No comments:

Post a Comment