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
samdsamd 

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


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>

 

dmchengdmcheng
Hello.  Did you find a solution for this?

Thanks
David
samdsamd
Hi David

I ended up using the code below.  It seemed to work for me...

Code:
[retURL=$Request.retURL]

Regards
Sam
olegforceolegforce

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,