Skip to main content

Posts

Showing posts from October, 2013

IP Ranges on Profiles

Use Case - An organization with some 50+ profiles is running a mission critical sfdc solution since last 5-6 years and after analysis of security implications decided to have IP based restriction on access. The organization in question is trying to make sure that mission critical application can be accessed only through office network or via VPN if outside office. The organization is global in nature and has 500+ possible IPs. Also, the deployment process involves migration of components through 4 boxes. Possible Solution:- 1. Manually add IPs to all profiles - 50+ profiles X 500+ IPs = 25000 IPs entry. Quite cumbersome indeed, may be hours and hours. Also, very much possible that Networking team wants to do testing with only few IPs first and then add more and more. 2. Use Eclipse to add IP ranges to profiles - It will need just addition of 500 IPs on one profile and latter just copy & paste the same in other profiles. I am going to describe below how we can mak

Memory Reference in Apex

Recently during one of project, I was creating a map of integer and list of integer. My code snippet something like:- I was expecting something like {1=(1), 2=(1,2 ), 3=(1,2,3), 4=(1,2,3,4), 5=(1,2,3,4,5), 6=(1,2,3,4,5,6), ...} as output. However, I was surprise to see the output as {1=(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), 2=(already output), 3=(already output), 4=(already output), 5=(already output), ...}. I was wondering what's wrong with my code and started exploring how I can fix it. After going through blogs & docs, I get to know that if I call some method like clear() on a list and put it in a map and use the same variable with modified values for next element of map, ultimately SFDC stores address of same variable in each element of map, because of which I finally get same value in each element of map as per above code. If I make a small change in my code,as shown below, my code will start yielding expected result:- If you closely look into change, instea