Javscript variable into pipeline

I have a .dsp application that works just fine. BUT the client wants to run this behind a portal applpication with a single sign-on

I have set my application (all .dsp and services) to Anonymous ACL and when I access it does not request username/passw.

OK so far, but my app needs to know who the logged on user is, I was using the PSUtilities.misc:getUser service.

The solution we have designed is that the portal already stores the userid (I am not bothered about pasww) in a cookie.

I can read the cookie in javascript at the start of each .dsp page, and want to extract the userid to pass to my app as a pipeline variable

My question is, I can disply the extracted userid using document.write(userid); in the javascript. How do I get this variable into the pipeline or the form so I can pass it to a bc service. if outside the script tags I do %value userid% it displays nothing

graham moisley

Just off the top of my head…I can think of a couple of ways to get the userid on the “pipeline”.

  1. After retrieving the userid from the cookie, you could set a hidden field in your form equal to the value of the userid. Then, when you submit the post in your form tag, the userid will be available on the pipeline.

  2. After retrieving the userid from the cookie, call the next page (or simply refresh the current page) and pass it along as a parameter. For example:

var userid = "foobar"; 
var pageurl = "mypage.dsp"; 
window.location.href=pageurl + "?userid=" + userid; 



You can do as Chris suggested. Additionally you can call or invoke the service from mypage.dsp using:

%invoke myService%

Your “userid” is available in the pipeline for you to access. From a java service you can access the value by referring to “userid”. In case of a flowservice, you will need to declare an input field with name “userid”.

Let us know how you go with it.


Chris and Amith, thanks for the quick responses.

I think I need to follow chris’s advice, and almost put a dummy page to read the cookie, set the variable and call my regular page

Amith, my page does an %invoke myService% %endinvoke%, but what I think is happening is that that is executed by the server, then the html is passed to the client which executes the js to resolve the userid. So although in my .dsp the js and document.form.userid.value sets up the variable correctly, in fact the service I am logically passing it to has already been executed.

I think I understand, so am planning to have a dummy page to determine the userid, and pass it in the url as per Chris, to the actual page.

Or does anyone know a better solution

thanks for the pointers guys



You are correct in your understanding that the invoke is being executed on the Integration Server before the HTML is returned to the client and the JavaScript is executed by the Browser.

When you need to pass parameters to a DSP you need to get then onto the URL. Using the “build-the-url-in-another-page-and-then-HTTP-redirect” seems like a reasonable solution to me.