Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
+1 vote
2 views
in Salesforce by (29.3k points)

why do we use maps in triggers instead of lists ? please help with few examples advantage of using maps.

1 Answer

0 votes
by (50.2k points)

You can directly use the Map for getting any record. You don't need 2nd for a loop.
Scenarios:
1) When moving line items from one opportunity to other opportunities we need to use the map
2) to determine whether an old value is changed or not in a trigger we need to use the map

You can learn more about Triggers In Salesforce.

Related questions

0 votes
1 answer
asked Jan 14, 2021 in Azure by dante07 (13.1k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...