function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
falksonfalkson 

Associating a Task with a Lead

Hi,
 
I'm trying to associate a task with a lead.  When I look at the field listing for a task it shows...
 
Lookup(Account,Opportunity,Case,Campaign,Contract,Solution,Product,Asset,Script) 
 
i.e. No Lead.
 
Also when you drill down it says the name of the field is What.
 
When I attempt to insert the task using the Lead ID I receive the following error.
 
java.lang.StringIndexOutOfBoundsException: String index out of range: 0
 
Any help would be appreciated.
 
Regards
 
Mike
Mike LeachMike Leach
Create a new Task sObject and set the WhoId to the Lead. WhatId must be left empty when Tasks are associated with Leads.
falksonfalkson
Thanks Mike.