Page 1 of 1

Set workstnid in a "Web application" Menu Item URL

Posted: Mon Jun 24, 2019 8:51 am
by mgardes
Hello,

Users have a workstnid variable in their Atrium shortcut on their desktop.
Example : http://tintin:8090/profoundui/atrium?wo ... licateid=1

We need to get the value of this variable when we get the job name.

When we create a "Rich Display File Application" Menu Item in atrium, it's ok. The job name is the same as the workstnid variable.

But, when we create a "web application" Menu item in atrium, how can we put the workstnid in the url ?



When we do no set it :
/profoundui/auth/start?duplicateid=1&pgm=puigc/LANCEUR&p1=INTCLIADM&l1=10&p2=puigc&l2=10&p3=TEST&l3=10&p4=1&l4=1&p5=0000401070&l5=300
=> Job name = PUI

When we set it manually :
/profoundui/auth/start?workstnid =toto&duplicateid=1&pgm=puigc/LANCEUR&p1=INTCLIADM&l1=10&p2=puigc&l2=10&p3=TEST&l3=10&p4=1&l4=1&p5=0000401070&l5=300
=> Job name = toto

Is it possible to set it dynamically ?

Thanks a lot

Re: Set workstnid in a "Web application" Menu Item URL

Posted: Tue Jul 30, 2019 1:43 pm
by Scott Klement
Hello,

Sorry, it looks like nobody answered this forum post. I hope that you've found an answer already?

The biggest problem I see with what you're doing is that you're using a "web application" launcher to launch a rich display. For that to work properly, you'll need to set up your programs as anonymous programs, which can cause security problems because now anyone can run the program by typing a url like /profoundui/start?pgm=puigc/LANCEUR into the browser URL bar. Because its anonymous, it no longer requires a sign-on to run the program. This might be okay for you if your object-level security is set up to make sure the QTMHHTP1 user doesn't have access to anything that's not intended for the public? But, as a general rule, this could be dangerous.

Assuming that you don't mind the security problem, however... it is possible to build the URL dynamically using JavaScript code.

You can begin the "url" box in the Web Application launcher with "js:". This tells Atrium that the value is a JavaScript expression to be evaluated as opposed to a hard-coded value. Then, you can write JavaScript code to build the URL any way you like.

For example, write a JavaScript function that calculates the workstnid:

Code: Select all

function getWorkstn() {
   // put your own code that calculates the workstnid here
   var myworkstn = "toto";
   return myworkstn;
}
Put that in a .js file the profoundui/userdata/extension/atrium directory.

Then set the URL for the "Web Application Launcher" like this:

Code: Select all

js: "/profoundui/auth/start?duplicateid=1&pgm=puigc/LANCEUR&p1=INTCLIADM&l1=10&p2=puigc&l2=10&p3=TEST&l3=10&p4=1&l4=1&p5=0000401070&l5=300&workstnid=" + getWorkstn()
When the user clicks the menu item (but before running the URL) it will evaluate the URL as a JavaScript expression, which in turn runs your function. The function can do its calculations and return the ID which is put into the URL.

I don't know how you'd get the workstnid from the desktop, though... there's really no easy way for JavaScript code to access the desktop.