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
Patrick ConnerPatrick Conner 

How to redirect to the "Related To" value from a custom "Complete" button on Task

I've created the following simple custom button on tasks to complete the task:
{!REQUIRESCRIPT("/soap/ajax/29.0/connection.js")}
var TskObj = new sforce.SObject("Task");
TskObj.Id = '{!Task.Id}';
TskObj.Status = 'completed';
var result = sforce.connection.update([TskObj]);
location.reload(true);
Of course the location simply reloads. I've attempted to create a window.location.href command to force load of the WhatId, but I'm not having any luck. Is there a way to do this without setting any triggers? I'm sure the solution is easier than I'm thinking. Thank you!