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
Akshay MouryaAkshay Mourya 

How to add Master-Detail Relationship to a custom object

Hi All,
I have created one custom object and I want to add Master-Detail Relationship with Task object but I am not getting Task object in Related To dropdown. 
User-added image
Kindly advise me for the same.

Thanks.
 
RituSharmaRituSharma
It's not possible. You can't create lookup or master details relationship with Task object. Refer the URL for some additional details -> https://trailblazers.salesforce.com/answers?id=9063A000000ibRFQAY
SwethaSwetha (Salesforce Developers) 
HI Akshay,
You cannot create master-detail to Task or Event (which are the 2 types of activities)

As it is not possible with standard functionality, if you are looking for a workaround, you can try the approach mentioned in https://salesforce.stackexchange.com/questions/82098/is-it-possible-to-create-a-lookup-or-a-master-detail-field-to-event-from-my-cust

I.e, to create a custom events object.

Related: https://salesforce.stackexchange.com/questions/68577/tasks-and-events-custom-related-list/68672#68672

Hope this helps you. Please mark this answer as best so that others facing the same issue will find this information useful. Thank you
Ramprasad VarriRamprasad Varri
Task belongs to activities. Activities is a general purpose object which exists only in association with another object. It has 2 important standard fields (what id,  who id) that are not there on other objects. Activities associate with other objects (Account, opportunity, et) using What Id and users/groups using Who Id.

As Activities associate themselves with other objects and users in a unique way, we cannot create custom relationship lookup or master detail relationship with Activities. This is to avoid using single task across multiple records.  It doesn't make sense right having same task on 2 accounts.  What will happen when the task is completed on one account, but not on the other.

You have the capability of adding multiple users to Activities. 

The recommended way of associating task with record is using whatId on Activities.

Hope this helps.
Ramprasad VarriRamprasad Varri
https://trailblazer.salesforce.com/ideaView?id=08730000000cIsaAAE