You need to sign in to do that
Don't have an account?
Kaity
Hi,
What is the significance of- trigger.newMap.keySet()?
Opportunity i=[select ownerid, id,Owner.manager.email,Owner.manager.name from opportunity where id=:trigger.newMap.keySet()];
Thanks
Kaity
trigger.newMap.keySet()
Hi,
What is the significance of- trigger.newMap.keySet()?
Opportunity i=[select ownerid, id,Owner.manager.email,Owner.manager.name from opportunity where id=:trigger.newMap.keySet()];
Thanks
Kaity
In trigger if you try to call trigger.newMap.keySet() on update event or after insert it will return Id of records which is going to process.
In trigger if you try to call trigger.newMap.keySet() on before insert then it will return null.
http://developer.force.com/cookbook/recipe/comparing-queries-against-trigger-old-and-trigger-new
http://www.salesforcetutorial.com/salesforce-collections/
I believe, the below link will provide you more insight.
>> http://www.iterativelogic.com/salesforce-apex-trigger-best-practices/
Regards
Pramod
More info: http://www.sfdc99.com/2014/01/12/introduction-maps/
.keySet() is a method used on maps that returns all the keys of the map. Since the key in the map above is the record ID, you are returned a set of all IDs in your map.