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
Anu Raj.ax1269Anu Raj.ax1269 

Closing task on lead without going to task page

I want to close the task on lead list page without going to task page an close. I just want to close the task by clicking cls link in front of created task. Please guide me, how can i do this.

Vinit_KumarVinit_Kumar

Hi Anu,

 

1.) cls is standard link provided by saleforce,you can't play with it.

 

2.) If I understand correctly,you want to change the status of task to be completed.There are couple of ways of doing it :

 

a.)You can create a custom button and can have custom JS code to change the status to completed

b.)You can create a controller class and you can have a custom method to update the statu to be completed.

prady-cmprady-cm

Create a custom button on task

 

Dipaly type = list button

Behaviour = execute javascript

Content source = onclick javascript

 

Paste the following code

 

{!REQUIRESCRIPT ("/soap/ajax/13.0/connection.js")}
 var records = {!GETRECORDIDS($ObjectType.Task)};
var newRecords = []; if (records[0] == null) { alert("Please select at least one row") } else {
                  for (var n=0; n<records.length; n++) { var c = new sforce.SObject("task"); c.id = records[n]; c.Status = "Completed";
                  newRecords.push(c); } result = sforce.connection.update(newRecords); window.location.reload(); }

 Goto leads page layout

Click on the wrench icon of the activities related list

Click on the buttons panel

select the button you created above, click on OK and you should have this button on the leads page and you can select the tasks to be closed using checkbox and hit the close task button.

 

This would close all selected tasks

rmranjith8881.3927046400771116E12rmranjith8881.3927046400771116E12
Hi,

Thanks Prady-cm,

It helped alot............

Please who was created this post, mark Prady-cm post as a Best answer, it would help others.

Thanks
Ranjith
Jason HekiJason Heki
Hello @prady-cm, is this code still sufficient or would we use something updated? I would like to put this button to close tasks directly on the task list too, but since this is from 2013 I want to make sure it still works. We don't have dedicated SF developers, so I'll be asking our admin to see if we can still do it. Thank you so much!