+ Start a Discussion
StenEStenE 

Task Object Related To custom object

HI,

 

The documentation tells me that i can create a task object which is related to an custom object by using the WhatID field. Is i creat a task via DML and link it to my custom object ID the insert will fail because of 'Related To: Opportunity/Account ID: id value of incorrect type: a04A000000Bj8wJIAR'. 

 

Has someone experience with this and is there a way to do this without any custom objects...?

 

Thanks,

Sten

Best Answer chosen by Admin (Salesforce Developers) 
sfdcfoxsfdcfox

Check your custom object (Setup > Create > Objects > Edit (Object Name) ) and check the "Allow activities" checkbox. WIthout this box checked, you can't assign a task or event to that type of object.

All Answers

sfdcfoxsfdcfox

Check your custom object (Setup > Create > Objects > Edit (Object Name) ) and check the "Allow activities" checkbox. WIthout this box checked, you can't assign a task or event to that type of object.

This was selected as the best answer
Vishal (Sops)Vishal (Sops)

I am running in to this problem for a couple of weeks, can you guys help me out. I have a custom object called CC Card, I want the trigger to execute only if the task is logged under this object and has a certain subject line. If both these conditions meet, I want to update few fields on this custom object. I am very much new to triggers but this is what i have managed to do so far, don't know how to proceed further..

 

trigger triggerFromTaskToCCCard on Task (after update) {

//Memory allocations for this trigger.

List<Task> TaskRecords = new List<Task>();
Set<Id> setCCCardID = new Set<Id>();

// Combine old and new trigger records into a single list.
if(Trigger.new!=null)
TaskRecords.addAll(Trigger.new);
if(Trigger.old!=null)
TaskRecords.addAll(Trigger.old);


// Collect all Related To (WhatId) values.
for(Task aTask:TaskRecords)
setCCCardID.add(aTask.WhatId);

 

 

Any help will be highly appreciated, thanks..

burner taleburner tale
Nice to see this here. Would you like to know more about the best games to play? Here you will get complete details about the run 3 unblocked online game. Check this for more details. https://run3online.co  (https://run3online.co)