You need to sign in to do that
Don't have an account?
paul.mcgurn
Using an email address as the Key for a Map
This seems to be bugged.
Example
Map<string,Contact> ccMap = new Map<string,Contact>();
Contact c1 = new Contact();
c1.firstname = 'Joe';
c1.lastname = 'User';
c1.email = 'joe@example.com';
c1.accountId ='<some id>';
ccMap.put(c1.email,c1);
This will always retgurn null:
Contact con = ccMap.get(c1.email);
I didn't see anything in the Apex documentation noting restrications on the string's value when creating a custom map.
Example
Map<string,Contact> ccMap = new Map<string,Contact>();
Contact c1 = new Contact();
c1.firstname = 'Joe';
c1.lastname = 'User';
c1.email = 'joe@example.com';
c1.accountId ='<some id>';
ccMap.put(c1.email,c1);
This will always retgurn null:
Contact con = ccMap.get(c1.email);
I didn't see anything in the Apex documentation noting restrications on the string's value when creating a custom map.
MissedCall
debug log:
What's your question?
paul.mcgurn
This wasn’t working for me. I ended up having to log out of Salesforce and log back in (I use the web based dev console), and then it did. So it was ‘some’ bug, but not specifically this.