• #28255
    Salesforce | Shahzad Shahzad #276
    Forcetalks

    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’;
    database.update(tk);

     

    #34006
    Salesforce | shariq shariq #1
    Forcetalks

    Hi,

    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.

CONTACT US

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

Sending

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 2018 Forcetalks. All Right Reserved.

Log in with your credentials

or    

Forgot your details?