You need to sign in to do that
Don't have an account?
dasari123
Soql query foe attachment on case object
Hi,
I wrote a soql to retrive the attachment from case object ,it is working fine ,but i can't see the ciontent of the attachment ,how can i retrive the content of the body through SOQl, or any possibility to download the attachment through SOQL
My Query is
SELECT ParentId, name,body
FROM Attachment
WHERE parentId IN (
SELECT Id FROM Case ) limit 100
O/P:
"/services/data/v30.0/sobjects/Attachment/00PZ00000015EJqMAM/Body" this what i got as body how can i know the content
I wrote a soql to retrive the attachment from case object ,it is working fine ,but i can't see the ciontent of the attachment ,how can i retrive the content of the body through SOQl, or any possibility to download the attachment through SOQL
My Query is
SELECT ParentId, name,body
FROM Attachment
WHERE parentId IN (
SELECT Id FROM Case ) limit 100
O/P:
"/services/data/v30.0/sobjects/Attachment/00PZ00000015EJqMAM/Body" this what i got as body how can i know the content
string attachString = attachment.body.ToString();
Blob body = EncodingUtil.base64Decode(attachString);
string UTF8 = body.toString();
string finalBody = EncodingUtil.urlDecode(UTF8, 'UTF-8');
finalBody should now be the attachment in legible string form.