-
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);
Log In to reply.
Popular Salesforce Blogs
Overcoming the Limitations of Duplicate Management in Salesforce
The volume of data in B2B organizations is doubling every year. Therefore, even if your data is clean today, it is only a matter of…
Best Salesforce Training Program In 2022
If you're seeking the best Salesforce training program to become a Salesforce developer in 2022, you've come to the correct place. Salesforce is a vast…
Salesforce Email and Events Integration Options
In the ever-evolving digital business landscape, a robust CRM platform like Salesforce becomes even more powerful when it can seamlessly integrate with your organization's email…
Popular Salesforce Videos
Salesforce Security – An Encryption Guide For The Paranoid
If you are using Salesforce, you would be having a lot of data stored in Salesforce objects. Some of it would even be sensitive enough…
Saving Journey History in Marketing Cloud
We explore how to leverage Marketing Cloud REST API and its automations to save all the journey history data for your organization. Includes a video…
2020 Salesforce Administrator Certification Start Here
Get ready for the administrator certification exam with interactive study tools. Collaborate and study with fellow Trailblazers in the Trailblazer Community. Learn with Salesforce experts…