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
sgumsgum 

get a parameter in a url

hi, everybody

I added a formula field to an object with this content:

HYPERLINK("https://na3-api.salesforce.com/secur/frontdoor.jsp?sid=" & GETSESSIONID() & "&retURL=/servlet/servlet.Integration?lid=01r500000009WP3⁣=1&param=a_parameter", "open")

This place a link that open a web-tab in my apeexchange app with a s-control.
My cuestion is:
how can I get the value of the parameter "param" (a_parameter) in the s-control placed in the web-tab?

thanks in advance
Doug ChasmanDoug Chasman
One of the new scontrol features we added in Winter '07 was the ability to access  the HTTP request parameters from inside your scontrol. For example you can use something like this in your scontrol:

{! $Request.a_parameter  }

MB ParkMB Park

Could you plese more  explain about  your reply ?

It's a best practice which you write a sample code.

Thank you!

Doug ChasmanDoug Chasman
I did not originally post an example because there is one in Help (pasted below) - but the example is a bit unclear on how this applies to the specific situation. Basically, you build the url any way you want using any approach that makes sense for your situation (if the url is being constructed inside another scontrol or weblink we recommend using the new urlFor() function, e.g. urlFor($Scontrol.MyFavoriteScontrol)) and inside the target/destination scontrol you can access any request params via $Request:

In this specific case we have the following formula that is generating the url and <a> tag:

HYPERLINK("https://na3-api.salesforce.com/secur/frontdoor.jsp?sid=" & GETSESSIONID() & "&retURL=/servlet/servlet.Integration?lid=01r500000009WP3&ic=1&param=a_parameter", "open")

and inside the target scontrol I can add something like:

<script>
var theValueOfA_Parameter = '{!$Request.a_parameter}';
</script>

which will be returned to the browser (given that a_parameter == 123456):

<script>
var theValueOfA_Parameter = '123456';
</script>


$Request

Description: A global merge field to use when referencing a query parameter by name that returns a value.
Use: Add $Request manually to your s-control.
S-Control Example:The snippet below, named Title_Snippet, requires two input parameters: titleTheme and titleText. You can reuse it in many s-controls to provide page title and theme in your HTML.
<h2 class=”{!$Request.titleTheme}.title”>​{!$Request.titleText}</h2>

The s-control below calls this snippet using the INCLUDE function, sending it the parameters for both the title and theme of the HTML page it creates.

<html>
<head>
</head>
<body>
{! INCLUDE($SControl.Title_Snippet,
[titleTheme = "modern", titleText = "My Sample Title"]) }

... Insert your page specific content here ...

</body>
</html>
Tips:
  • This global variable is only available for custom buttons, links, and s-controls.

Message Edited by Doug Chasman on 02-09-2007 06:51 AM

BritishBoyinDCBritishBoyinDC
I also struggled with this one, but here is another example I got to work:

I have an inline s-control that creates the following link:
https://na3.salesforce.com/servlet/servlet.Integration?lid=01N500000000ZKo&a_parameter=0015000000I0etwAAB

Where 01N500000000ZKo is the Id of the s-control and 0015000000I0etwAAB is the account Id I want
to pass into the s-control as a parameter.

The s-control is a simple redirect control, allowing me to open up the account id in the same window
without creating the double tabbing effect:

< script language="JavaScript">


var param = "{!$Request.a_parameter}";

param = "/" + param;

    function redirect()
    {
    parent.frames.location.replace(param);
    }

    redirect();

    < /script >

Hope that helps!
MarkL.ax269MarkL.ax269
BritishBoy, I know this thread is a little old but your simple method just made my day. Very quick, elegant and most importantly, solves a problem. Thanks!