You need to sign in to do that
Don't have an account?
arjunkodidalasfdc1.3904276015566733E12
Attaching a task to Lead
Hi,
I need to assign a Lead to Task. How can i do that.
I know that we can create a task with who id of lead as below.
Task newTask = new Task(
ActivityDate = Date.today(),
WhoID = Lead.OwnerId
OwnerId = User.UserId;
Status = 'Not Started',
type = 'Other',
Priority = 'Normal',
Subject = 'Other',
description = taskDescription
);
insert newTask;
But i have a situation to assign a Task to Lead. How can i assgn it? Is there any method to assign a task to lead?
Lead newLead=new Lead();
newLead.TaskID= newTask.TaskID;
(or)
newLead.Activities.Add(newTask.TaskID) like this?
Thanks.
I need to assign a Lead to Task. How can i do that.
I know that we can create a task with who id of lead as below.
Task newTask = new Task(
ActivityDate = Date.today(),
WhoID = Lead.OwnerId
OwnerId = User.UserId;
Status = 'Not Started',
type = 'Other',
Priority = 'Normal',
Subject = 'Other',
description = taskDescription
);
insert newTask;
But i have a situation to assign a Task to Lead. How can i assgn it? Is there any method to assign a task to lead?
Lead newLead=new Lead();
newLead.TaskID= newTask.TaskID;
(or)
newLead.Activities.Add(newTask.TaskID) like this?
Thanks.
Task newTask = new Task(
ActivityDate = Date.today(),
WhoID = Lead.Id,
OwnerId = User.UserId;
Status = 'Not Started',
type = 'Other',
Priority = 'Normal',
Subject = 'Other',
description = taskDescription
);
WhoId needs to be a lead or contact id
WhatId can be account, campaign, case or custom object with activity enabled.