• #28255
    Salesforce | Shahzad Shahzad #638

    moving task of subtype ListEmail from one contact to another using Salesforce apex

    We are trying to move a task from one contact to another in a trigger. the task is created by ListEmail functionality.

    We are getting an exception if re-assigning the WhoId. Exception:

    Update failed. First exception on row 0 with id 00T1N00002TXv3jUAD; first error: FIELD_INTEGRITY_EXCEPTION, Related To ID: id value of incorrect type: 0XB1N000000XaCuWAK: [WhatId]

    This is the sample code:

    List<Task> task = [SELECT Id, RecordTypeId, WhoId, WhoCount, WhatCount, Subject, AccountId, TaskSubtype, AccountId__c, EmailListWhatID__c FROM Task where Id =’00T1N00002TXv3jUAD’];

    system.debug(‘task = ‘ + task);
    Task tk = task.get(0);
    tk.WhoId = ‘0031N00001UvZDpQAN’;


    Salesforce | shariq shariq #4


    Given that the exception relates to the WhatId, I suspect that whatever the custom object type referred to by the prefix 0XB is, it does not have Allow Activities active on the object metadata.

    Hope this helps.

Viewing 2 posts - 1 through 2 (of 2 total)

Please to reply to this topic.


We're not around right now. But you can send us an email and we'll get back to you, asap.


About Us

Forcetalks is a Salesforce collaboration platform for coders & developers, geeks & nerds, consultants & business heads, admins & architects, managers & marketers and of course the business owners. A community where you can learn from, where you can contribute to. For you. For Salesforce. Read More...

Copyright 2019 Forcetalks. All Right Reserved.

Log in with your credentials


Forgot your details?