You need to sign in to do that
Don't have an account?
SeAlVa
Attachment body mismatch
Hi everybody,
lets see if I'm missing anything or something because I think this might be a salesforce bug.
I am developing a REST webservice, see the following code snippet.
... returned.signatures = new List<Map<String,String>>(); for(Attachment att : [ SELECT Body, ParentID FROM Attachment WHERE ParentID IN :new Map<ID,Order__c>(returned.orders).keyset() AND Name like 'Signature%']){ System.debug(att.id); System.debug(att.parentID); system.debug(EncodingUtil.base64Encode(att.body)); returned.signatures.add(new Map<String,String>{'Id'=>String.valueOf(att.parentID),'signatureBody'=>EncodingUtil.base64Encode(att.body)}); } ...
The thing is that if I go to the debug logs,
I see the attachment ID and the parentID properly, but the att.body is from another file :S (if I navigate to the AttachmentID and click on View, I see the good one)
Is there anything that I am doing wrong?
I would rather try to keep my SOQL simple by fetching the Object's records and related attachments. Something like
List<Account> accList = new List<Account>();
accList = [SELECT Id,Name,(SELECT Id FROM ATTACHMENTS) From Account];