You need to sign in to do that
Don't have an account?
Mahesh KG
How to save the attachment in pdf for an account
Hi Team,
Can you please help me saving the pdf document in Notes & Attachments section of the Account creation.
i am able to save the file but not as an pdf attachment. when i had set contenttype as application/pdf. the file is not getting opened.
Thanks and Regards
Mahesh
Can you please help me saving the pdf document in Notes & Attachments section of the Account creation.
i am able to save the file but not as an pdf attachment. when i had set contenttype as application/pdf. the file is not getting opened.
Thanks and Regards
Mahesh
Hope you are doing well...!!
Please try below code :
in which I have declared one blob variable name filebody .
You need to assign you blob file body to filebody variable.
Regards,
Foram Rana
I tried the below code,
when i am opening the file i am not able to load it,
Attachment attach = new Attachment();
attach.ParentId=restAcc.Id;
attach.ContentType=contentType;
attach.Name=attachName;
Blob beforeblob = Blob.valueOf(euaBody);
String paramvalue = EncodingUtil.base64Encode(beforeblob);
System.debug(euaBody + ' is now encoded as: ' + paramvalue);
Blob afterblob = EncodingUtil.base64Decode(paramvalue);
System.debug(paramvalue + 'is now decoded as: ' + afterblob.toString());
attach.Body=afterblob;
//attach.Body=EncodingUtil.base64Decode(euaBody);
insert attach;
Can you suggest me what changes needs to be done?
Thanks and Regards
Mahesh KG
If you are uploading pdf then contentType must be application/pdf
I just want to know what is the type of euaBody ??
euaBody is encoded base 64 String?
What is the size of file body ??
the type of the euaBody is String
file size is 6mb
Any update on this?
any help will be appreciated, Thanks