-
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
Unveiling the Top Trio: A Comprehensive Comparison of Three Most Effective Ways to Integrate Multiple Salesforce Instances
Salesforce has long been a dominant force in the CRM landscape, setting the gold standard despite its high costs and challenging implementation process. Its ability…
Why You Should Hire Salesforce Consultant for Your Business Process?
Be it a small business or a big enterprise, with the guidance of the best Salesforce consulting services, organizations can achieve greater goals with utmost…
Territory Management In Salesforce
Steps To Enable Territory Management In Salesforce:- 1. Log in to your Salesforce org. go to Setup, enter Territory in the Quick Find box. 2.…
Popular Salesforce Videos
Salesforce Lightning Development Tutorial - Hello World!
Salesforce Lightning Custom Component Development Tutorial for Beginners - Let us implement our first custom lightning component - Hello World! Video Resource: Lightning Evangelist
Custom Login Page Using Mulesoft | Salesforce Tutorial
In this video, you will learn how to create a custom login page using Mulesoft. Watch and learn. If you have any doubts do let…
How to Elevate Engagement with Salesforce Experience Cloud?
Salesforce Experience Cloud helps companies create personalized portals for customers to find answers, collaborate, and be part of a community. In this video, ENWAY will…