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

Comparing changed fields on an sobject using Schema.describe
HI,
I'm trying to iterate through all sobject (opportunity) fields and see which ones changed against my trigger map.
Currently 's' is an incompatible key type Schema.SObjectField for MAP<Id, Opportunity>. Any help?
fyi Map<Id, Opportunity> newMap = Trigger.newMap()
for(Opportunity o: newMap.values()) { for(Schema.Sobjectfield s: SObject.describe('Opportunity')) { if(newMap.get(o.Id).s != oldMap.get(o.Id).s) { //do stuff in a different class } } }
Have already been referencing http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_dynamic_describe_objects_understanding.htm
http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#CSHID=apex_methods_system_fields_describe.htm|StartTopic=Content%2Fapex_methods_system_fields_describe.htm|SkinName=webhelp
http://www.salesforce.com/us/developer/docs/apexcode/salesforce_apex_language_reference.pdf
You have to use SObject.get(SObjectField) for a comparison.
All Answers
You have to use SObject.get(SObjectField) for a comparison.
That was super helpful! Thank you!