You need to sign in to do that
Don't have an account?
Will a Map contain only id's of a record when populated through select statement..??
map<id,case> caseLst =new map<id,case>([select id,AccountId,status from case where Accountid=:mp.keyset()]);
here mp.keyset() contains several Accountids that the cases are related to.
now my question is will the above MAP's key always contain the ids of case ? Is there any way so that I can keep AccountId field of a case object as a key of the MAP when populated through SELECT statement ?
I tried to give--
map<String,case> caseLst =new map<String,case>([select AccountId,status from case where Accountid=:mp.keyset()]);
But then also caseLst.keyset() contains only ids of the case records not the AccountIds.
But you can code by yourself, like
map<id, case> mycase = new map<id, case>();
for(case cs : [select id, AccountId, status from case limit 5]) {
mycase.put(cs.accountId, cs);
}
All Answers
But you can code by yourself, like
map<id, case> mycase = new map<id, case>();
for(case cs : [select id, AccountId, status from case limit 5]) {
mycase.put(cs.accountId, cs);
}
Ys..Thats what I have done...Ok..Anyhow Thanks for confirmation.