+ 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!