You need to sign in to do that
Don't have an account?
aaaaaaaaaaa
Custom settings used for comparing new and old values
Hi All,
I have to compare new and old values for few fields of a object.How can it be done using custom settings and used in apex class?
Can you help me few line of codes?
Thanks for helping
I have to compare new and old values for few fields of a object.How can it be done using custom settings and used in apex class?
Can you help me few line of codes?
Thanks for helping
Could you please elaborate why you are using custom settings here and what do you want to compare your values with?
Thanks!
Can i store 5 fields of an object in a custom setting and then use that custom setting to compare new and old value for a record using trigger?
I mean some 1-2 lines of code using custom settings which compares the new values for 5 fields not equal to old values for 5 fields.
Let's say that your custom settings name is Original_values__c; then;
List<original_values__c> custSettingList = [SELECT fields FROM original_values__c ];
for (object obj: Trigger.new) {
for (original_values__c orgV: custSettingList) {
if (obj.fieldName == orgV.fieldName) {
//Perform some action here
}
}
}
Hope this helps!
Thanks!
Why would you need a custom setting?
You can simply use trigger.New and trigger.OldMap to compare these values?