You need to sign in to do that
Don't have an account?
Anjaneylu
Trigger.oldMap.keySet()
Hi Experts,
what is the meaning of Trigger.oldMap.keySet(), When we will use this trigger. and what is the function of this trigger..
if possible explain with simple example..
Please help me,
Thanking you & Regards,
Anji reddy
what is the meaning of Trigger.oldMap.keySet(), When we will use this trigger. and what is the function of this trigger..
if possible explain with simple example..
Please help me,
Thanking you & Regards,
Anji reddy
In above code example I am checking is status value is changed to some specific value and product family too..then only i am doing my processing..else not..
because for example say I want to create one task when account status is shipped...
so if I will not add the filter then it will create task everytime whenever I will update the anything on account..
but by comparing old value with new value we can check if status is changed or not
let me knwo if it is clear to you..
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Thanks,
Sandeep
Salesforce Certified Developer
All Answers
When you update the record then you will get old map and new map in trigger which means, you get old values of the record and then new values of the record...
Trigger.oldMap.keySet() -- this will contain id of all the records those are updated..
old value we use normally to compare things based on our business logic..
lets take an example:
you want to update the account field only when status is changed...
now if you will not update the status but you updated the other field in account, this time trigger will get fire as you have written trigger on after update event of account..
so in code you can check the condition if Trigger.oldMap.status != trigger.newmap().status -- which means if status is updated then only your trigger logic should execute..
let me know if you need more elaboration..
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Thanks,
Sandeep
Salesforce Certified Developer
Nice explanation..
Could you Please explain with some simple trigger..
Regards,
Anji
In above code example I am checking is status value is changed to some specific value and product family too..then only i am doing my processing..else not..
because for example say I want to create one task when account status is shipped...
so if I will not add the filter then it will create task everytime whenever I will update the anything on account..
but by comparing old value with new value we can check if status is changed or not
let me knwo if it is clear to you..
P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
Thanks,
Sandeep
Salesforce Certified Developer
pr.Status__c = opp.Status__c;
Meaning for this Can anyone help me