function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NishhNishh 

Can we save attachment in activity history through code?

How can we save attachment in activity history through apex? It is not possible via standard features
Please advise
Vinita_SFDCVinita_SFDC
Hello,

Acitvity history object is read only. By any means you can not edit it.
NishhNishh

Hi,
Thanks for your quick response.
Actually my attachments are saved in notes and attachments but if it is possible to add attachments in attachment related list then we do not need to save attachments in notes and attachments.
 

I am creating an opportunity and sending a confirmation email to the contact person. Email is going to that particular person with attachment and it will save record in activity history but not showing attachments in attachment related list of activity history

Please help

Vinita_SFDCVinita_SFDC
Hi,

I could list down few options:

1) General activity records don't support attachments. You could make a url field and store the files off the Salesforce servers (eg. a company file store or a third party). Or, you could create a custom object and store the attachments on the custom object, and relate the task/event to the custom object.

2) You can use the My E-mail To Salesforce options to send e-mails from your external mail client and using that there is an option to automatically save attachments that are sent. You can review your settings by going into Setup>Personal Setup>E-mail>My E-mail to Salesforce.

3)There are couple of ideas on idea exchange, vote them :

https://success.salesforce.com/ideaSearch?keywords=save%20attachments%20in%20activity
NishhNishh
Thanks Vinita,

So it is not possible to write code for saving attachments in activity history?
Vinita_SFDCVinita_SFDC
Unfortunately, it is not possible as of now.