I have to pass a child record's field value while iterating by Parent records. I am getting invalid Foreign key relationship error. Can someone please help me here?
Code snippet:
global class Account_chk {
WebService static void method1(Id i) {
List<Call2_vod__c> a= new List<Call2_vod__c>();
List<Attachment> p=new List<Attachment> ();
List<Attachment> exist=new List<Attachment> ();
exist=[select ParentId,id from Attachment];
Map<Id, Attachment> existMap = new Map<Id, Attachment>();
Map<Id,Call2_vod__c> signMap = new Map<Id, Call2_vod__c>();
for (Attachment att : exist) {
existMap.put(att.ParentId, att);
}
List<Account> acc = new List<Account>([select Id,(select Signature_vod__c,Name from Call2_vod__r where Signature_Date_vod__c !=Null and Account_vod__c not in :existMap.keySet() limit 1) from Account ]);
for (Account call: acc)
{
Attachment record = new Attachment(Name = Call.Name ,ParentId = call.Id, Body = EncodingUtil.base64Decode(get(call).Signature_vod__c), ContentType = 'image/jpeg');
if (record.parentId !=Null ) {
p.add(record);
}
}
try { insert(p);
} catch(System.DMLException e){
System.debug('The following exception has occurred: ' + e.getMessage());
}
}
}
Getting error: Method does not exist or incorrect signature: get(SOBJECT:Account) at line 20 column 113
get()
method?