Set workstnid in a "Web application" Menu Item URL

Use this board to ask questions or have discussions with other Atrium users.
Post Reply
mgardes
New User
Posts: 9
Joined: Thu Nov 22, 2018 10:56 am
First Name: Maximilien
Last Name: G.
Company Name: SERMES
City: Strasbourg
Country: France
Contact:

Set workstnid in a "Web application" Menu Item URL

Post 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
Scott Klement
Experienced User
Posts: 2711
Joined: Wed Aug 01, 2012 8:58 am
First Name: Scott
Last Name: Klement
Company Name: Profound Logic
City: Milwaukee
State / Province: Wisconsin

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

Post 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.
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest