You need to sign in to do that
Don't have an account?

trigger.newmap.keyset
Hi Team,
Could you please check below link?
https://developer.salesforce.com/page/Best_Practice:_Avoid_SOQL_Queries_Inside_FOR_Loops
In this link they used trigger.new.keyset in before insert event ( in a code where they used best practise). I read somewhere that if we use trigger.newmap.keyset in before insert then it will give null id's.
Could you please clarify my doubt?
Could you please check below link?
https://developer.salesforce.com/page/Best_Practice:_Avoid_SOQL_Queries_Inside_FOR_Loops
In this link they used trigger.new.keyset in before insert event ( in a code where they used best practise). I read somewhere that if we use trigger.newmap.keyset in before insert then it will give null id's.
Could you please clarify my doubt?
- In the trigger, if you try to call trigger.newMap.keySet() on update event or after inserting it will return Id of records which are going to process.
- In the trigger, if you try to call trigger.newMap.keySet() on before insert then it will return null.
I hope it will be helpful.Best Regards
RahulKumar
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_context_variables.htm
if ypou are not getting please let us know