You need to sign in to do that
Don't have an account?
Patrick Conner
Redirect to "Related To:" link from custom "Completed" button on task
I've created a custom button on tasks which will complete the task. However I'd like it to then redirect to the related to: value (usually account page or custom object page).
{!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);
Code snippet pasting was causing troubles posting for me so I've pasted in txt above. I've attempted to use window.location.href to load a task.WhatId variable addended to my instances URL unsuccessfully. Any ideas how to pull this off without using triggers? I'm sure it's a simple solution. Thank you.
{!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);
Code snippet pasting was causing troubles posting for me so I've pasted in txt above. I've attempted to use window.location.href to load a task.WhatId variable addended to my instances URL unsuccessfully. Any ideas how to pull this off without using triggers? I'm sure it's a simple solution. Thank you.
window.location.href = '/'+TsjObj.id;
Not sure what you are asking about