You need to sign in to do that
Don't have an account?
Could not achieve Chatter Preview
I have a approval in process to post the attachments to Chatter,
If a record is Approved which is created through UI with attachments, I am able to view the preview of Attachments.
I am not able to see the preview of attachments after approval of records created through inbound email.
Is any thing i need to add in the code or?
public class EmailParsingActivity {
public void attachToRecord(Messaging.InboundEmail.BinaryAttachment[] bAttachments, ID abcdRecId) {
String contents=''; //ok
List<Attachment> listAttach = new List<Attachment>();
if(bAttachments != null) {
for(Messaging.InboundEmail.BinaryAttachment bAttach : bAttachments){ //ok
system.debug('attach file name ' + bAttach.filename);
Attachment attach = new Attachment();
//attach.Body = Blob.valueOf(bAttach.body.toString());
String b64Data = EncodingUtil.base64Encode(bAttach.body);
//Blob bab = bAttach.body;
attach.Body = Blob.valueOf(b64Data);
attach.Name = bAttach.filename; // name of the attachement should be same a attached to email
//attach.parentId = submitRecord.Id;
attach.parentId = abcdRecId;
listAttach.add(attach);
}
system.debug('attach list size ' + listAttach.size());
insert listAttach;
}
}
}
I would appreciate if someone assist me with the solution. Thanks in Advance-----
public class EmailParsingActivity {
public void attachToRecord(Messaging.InboundEmail.BinaryAttachment[] bAttachments, ID urRecID) {
List<Attachment> listAttach = new List<Attachment>();
if(bAttachments != null) {
for(Messaging.InboundEmail.BinaryAttachment bAttach : bAttachments)
{
//system.debug('attach file name ' + bAttach.filename);
Attachment attach = new Attachment();
attach.Body = bAttach.body;
attach.Name = bAttach.filename; // name of the attachement should be same a attached to email
attach.parentId = urRecID;
listAttach.add(attach);
}
system.debug('attach list size ' + listAttach.size());
insert listAttach;
}
}
}
All Answers
Me too Facing the Same Issue , Have you got any Solution for this Issue, please let us know
Thanks in advance
public class EmailParsingActivity {
public void attachToRecord(Messaging.InboundEmail.BinaryAttachment[] bAttachments, ID urRecID) {
List<Attachment> listAttach = new List<Attachment>();
if(bAttachments != null) {
for(Messaging.InboundEmail.BinaryAttachment bAttach : bAttachments)
{
//system.debug('attach file name ' + bAttach.filename);
Attachment attach = new Attachment();
attach.Body = bAttach.body;
attach.Name = bAttach.filename; // name of the attachement should be same a attached to email
attach.parentId = urRecID;
listAttach.add(attach);
}
system.debug('attach list size ' + listAttach.size());
insert listAttach;
}
}
}