You need to sign in to do that
Don't have an account?
Priyank Sahu
Hello guys i have to write Trigger on account insertion and updation
Using Trigger
· On Account insertion and updation, get a Map (Account Id as Key and Account record as Value) with no duplicates.
· Just show Map values in Debug
· On Account insertion and updation, get a Map (Account Id as Key and Account record as Value) with no duplicates.
· Just show Map values in Debug
You no need to right any extra logic for this. You just need to use trigger context variables as below. Please let me know if it helps you.
trigger AccountTrigger on Account (after insert, after update) {
// trigger already provides all the new Record Map
// which is responsible for firing the trigger.
// Trigger.NewMap means it is a Map<Id, Account>
System.debug(Trigger.newMap);
//Trigger.New means it is a List<Account>
Syste.debug(Trigger.New);
}
You can refer other trigger contextvaraibles at below link. which could be helpful for you.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_context_variables.htm
Regards,
Pawan Kumar
All Answers
You no need to right any extra logic for this. You just need to use trigger context variables as below. Please let me know if it helps you.
trigger AccountTrigger on Account (after insert, after update) {
// trigger already provides all the new Record Map
// which is responsible for firing the trigger.
// Trigger.NewMap means it is a Map<Id, Account>
System.debug(Trigger.newMap);
//Trigger.New means it is a List<Account>
Syste.debug(Trigger.New);
}
You can refer other trigger contextvaraibles at below link. which could be helpful for you.
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_context_variables.htm
Regards,
Pawan Kumar