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
mahimmahim 

How can we save send email information in Activity History as a related list of custom objects.

HI,

 

  I have one Object Sales Order. I created detail Page button email PDF, I am clicking on this button it should send an email to Contact and should store the information in Activity History as a related List of sales Order. 

 

I know it will store the Contact related List but I would like to show in Sales Order Related List Activity History any idea?

 

Any help is appreciated 

 

When I am sending an email from class I have used SetTargetobjectID(Contactid). 

digamber.prasaddigamber.prasad

Hi,

 

If you are using SendEmailMessage to send email, then you can use setWhatId() method to set ID of 'Sales Order' record and this activity will automatically come under related list of your 'Sales Order' record. Please see below link for detail

 

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_Messaging_SingleEmailMessage_setWhatId.htm

 

If not possible by above link, then you can create a trigger on activity (event/task) and set the WhatId to your custom object "Sales Order".

 

Let me know if you have any specific question.

 

Happy to help you!