You need to sign in to do that
Don't have an account?

Map issue
Hello All,
map<id, account> am= new map<id,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am)
i have executed this code script , its working fine , but i tryied to executed bellow code i am getting error , please help me
what is the issue
map<name, account> am= new map<name,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am);
Kindly help me with my doubt
Thanks :)
map<id, account> am= new map<id,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am)
i have executed this code script , its working fine , but i tryied to executed bellow code i am getting error , please help me
what is the issue
map<name, account> am= new map<name,account>([select id,name from account limit 10 ]);
system.debug('ammm===>'+am);
Kindly help me with my doubt
Thanks :)
If you want to use the account name as the key of your map, you will have to build the map in a loop:
All Answers
If you want to use the account name as the key of your map, you will have to build the map in a loop:
name is not datatype, by default id will come up as a key because that is unique.