function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RaviKumarRaviKumar 

Can we Use DML(Delete) on Map Collection Type

Can't we delete Records by using Map Collection Type....?

Map<Id, Account> m = new Map<Id,Account>([Select id from Account Limit 3]);
delete m;

How to achieve by using Map?

 
Best Answer chosen by RaviKumar
bob_buzzardbob_buzzard
You can't use a map, but you can simply pass the values list from the map as follows:
 
Map<Id, Account> m = new Map<Id,Account>([Select id from Account Limit 3]);
delete m.values();