-
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
Salesforce Lightning vs. Salesforce Classic: Which One You Should Choose
What is Salesforce Lightning? Salesforce Lightning, first announced at the Dreamforce conference in 2015, represents the company’s vision for the CRM platform moving forward. The…
Salesforce Field Service Lightning Mobile Extension Toolkit (Beta)
For any field service organization to be successful, it is important to give ample attention to the management. Managing the field forces and service technicians…
5 Top Benefits of Using Salesforce CRM for Banks in 2023
A CEO of a well-known investment bank once remarked proper use of technology is the cornerstone of success of a modern financial organization, and rightly…
Popular Salesforce Videos
Dreamforce 2020 FAQs | Dreamforce To You | Salesforce Event
As the COVID-19 situation continues to evolve, questions around virtual Dreamforce 2020 continue to increase and that's why we've gone ahead and answered all the…
4 Benefits of Salesforce Data Services (ETL)
When your enterprise needs to integrate data from a different application, Salesforce Data Services will help your company in Extracting, Transforming, and Loading the gathered…
What is Salesforce Commerce Cloud? | Salesforce Video Tutorial
Do you know what is Salesforce Commerce Cloud? Formerly called Demandware, it is a cloud-based service for unifying the way businesses engage with customers over…