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
Liam Lu 10Liam Lu 10 

Tasks Related two objects

Hello

I am pretty new to salesforce. I am wondering am I able to related to two different objects in Task? Basically, if I create a task under my quote, I would like the task can be seen in the corresponding opportunity's task history as well in additional to the activity history under quote since quote has a relation with opportunity. I did a lot of searches but I did not find any helpful answer yet. Is there anyone can give me a hint on this, please? Thanks a lot in advance.
Ajinkya1225Ajinkya1225
Hi Liam,

You are correct! You cannot associate a task with two objects. There is a special field on task- 'AccountId' which gets populated if the task is created on Asset, Case, Contract, Opportunity, Order. 

For your particular scenario, I would suggest on creating a visualforce page to show tasks as a related list.

Please upvote and mark this answer as solved, if it helped you.
Cheers!
Ajinkya Deshmukh
NagendraNagendra (Salesforce Developers) 
Hi Liam,

For Tasks this will not be possible without having a unique task for each project. You can use APEX to automate this for you but you will have multiple tasks.

A can be assigned to one person (lead/contact) and/or one object (account, opportunity, custom object).

SFDC Help has a couple of nice articles to help you get started:
https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/relationships_among_objects.htm
https://developer.salesforce.com/forums?id=906F0000000fzJLIAY
http://salesforce.stackexchange.com/questions/79777/multiple-many-to-many-relationships-on-same-custom-object



Kindly mark this as the best answer if it helps you.

Best Regards,
Nagendra.P