You need to sign in to do that
Don't have an account?
samd
How to create retURL for an S-Control which overrides a delete operation
Hi
I have created the S-Control below to override the delete button for tasks. The idea is that tasks with a "Lead Follow Up" record type cannot be deleted, but all other record types should be deleted as per a normal delete operation. The problem is that I don't know what to use for the retURL shown in red below. The "Action.Task.View" is clearly incorrect since the task will have been deleted when that action is called. I need to be able to get back to the page from where the delete was called. Is there any way of doing this?
Many thanks
Sam
I have created the S-Control below to override the delete button for tasks. The idea is that tasks with a "Lead Follow Up" record type cannot be deleted, but all other record types should be deleted as per a normal delete operation. The problem is that I don't know what to use for the retURL shown in red below. The "Action.Task.View" is clearly incorrect since the task will have been deleted when that action is called. I need to be able to get back to the page from where the delete was called. Is there any way of doing this?
Many thanks
Sam
Code:
<html>
<head>
<script src="/soap/ajax/9.0/connection.js"></script>
<script language="JavaScript">
function initPage()
{
if ("{!Task.RecordType}" == "Lead Follow Up")
{
alert("Lead Tasks cannot be deleted. Lead Tasks are closed when converted to an opportunity or when rejected.");
history.go(-1);
}
else
{
window.parent.location.href = "{!URLFOR($Action.Task.Delete, Task.Id , [retURL=URLFOR($Action.Task.View, Task.Id)],true)}";
}
}
</script>
</head>
<body onLoad="initPage()">
</body>
</html>
Thanks
David
I ended up using the code below. It seemed to work for me...
Regards
Sam
Hello,
I am trying to implement your code, but for some reason it skipson the if and jumps to else right away.
can you give me advice?
Thanks,