You need to sign in to do that
Don't have an account?
Ramana V
Trigger to get old and new values of number
Hi All,
I have one number field called seats__c in custom object. My requirement is when I change Seats__c value, I want to capture subtraction of old and new value in another number field(Removed__c). I have written trigger as below. But I am getting some error on this. Can anyone tell me that where I am doing wrong. Please see my code below.
Error
I have one number field called seats__c in custom object. My requirement is when I change Seats__c value, I want to capture subtraction of old and new value in another number field(Removed__c). I have written trigger as below. But I am getting some error on this. Can anyone tell me that where I am doing wrong. Please see my code below.
trigger quanCol on College__c (after update) { List<college__c> collist = [select id,Seats__c, Removed__c from College__c where Id =: Trigger.New]; for(College__c c : collist) { c.removed__c = c.Seats__c - trigger.oldMap.get(c.id).Seats__c; } update collist; }Please help me here. Thanks in Advance
Error
Hi Ramana,
Please Find the solution.
If it will help you Please mark best answer
Thanks
All Answers
https://help.salesforce.com/articleView?id=000313950&type=1&mode=1
https://salesforce.stackexchange.com/questions/84646/apex-cannot-insert-update-activate-entity-self-reference-from-trigger
Let me know if it helps you and close your query by marking it as solved so that it can help others in the future.
Thanks.
Hi Ramana,
Please Find the solution.
If it will help you Please mark best answer
Thanks