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

URLFOR and "current" records

I am trying to make an S-control which displays a list of rows and lets the user click on a row to view the detail page.   Creating the link for them to click on has proved tricky because using URLFOR only seems to work if the current S-control was passed in a "current" Id.  I have managed to work around this by passing the Id to a second S-control and having that S-control do the URLFOR and immediately refresh to the desired detail page.  That is a pretty ugly hack though and I am sure hoping someone has a better solution!

To clarify what I am saying, here is the hack:

S-control 1:
    output += "<td class='dataCol col02'>" +
                    "<a href='" + "{!URLFOR($SControl.Employee_View)}" +
                    "&eid=" + EmployeeRow.Id + "'>" + EmployeeRow.Name + "</a></td>";

S-control Employee_View:

<script language="javascript" type="text/javascript">
function initPage()
    window.parent.window.location="{!URLFOR($Action.DDEmployee__c.View, DDEmployee__c.Id)}";
<body onload="initPage();">