I have a custom object Custom__c and I am accessing its fields by using
Public Custom__c custom1 {get;set;}
Map<String, Schema.SObjectField> map = Schema.SObjectType.Custom1__c.fields.getMap();
for(String fieldName : map.keySet()) {
//using the fields for some processing using custom1
this.custom1 = [select fieldName from Custom1 where.....];
}
Then I create another object for Custom__c
Custom__c custom2 = new Custom__c();
Now what I want to do is assign the custom fields of custom2 the values of custom fields of custom1.
for(String fieldName : map.keySet()) {
value of fieldName of custom2 = value of fieldName of custom1
}
I am not sure how to achieve this. All I know is it can be (?) done using DescribeResult, or is there any other way?