+1 vote
1 view
in Salesforce by (25.5k 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 (42.7k 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.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...