cancel
Showing results for 
Search instead for 
Did you mean: 

Display a message from a Router Script

Former Member
0 Kudos

Hi all,

Ive been playing around with router scripts and Ive successfully managed to get them to make decisions, send emails, log an error etc but I cannot find any way of making the script display a message to the user .

Is there anyway of doing this ? either as a popup window (like the text work instruction) or into the special instuction area of the POD.

We are running visiprise 4.2 and Ive tried several things that I have found in the javadocs but nothing has worked so far :o(

Thanks for any help you can give.

Kev

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Kev

You can do this by throwing a standard error. In POD maintenance, you can make this appear as a popup (this affects all error messages though) by checking Error Popup on the main tab.

Throw an error by for example:

importClass(Packages.com.genrad.frame.BasicBOBeanException);

throw new BasicBOBeanException(101, new Data("ERROR", "Some error message"));"

Former Member
0 Kudos

Yes , I can do it that way as I can already write errors but I would rather not . It doesn't feel right using error messages to pass messages to the user and I also don't want real errors popping up like that either :o( unless thats my only option !

Is there any other way or is this my only choice ?

Ive tried displayError and displayMsg in Apputils but couldn't make them do anything !

Kev

Edited by: K_Hunter on Aug 2, 2011 6:05 PM

0 Kudos

Hi Kev,

Please note that router scripts supposed to be used for next step decision making only. So, I believe Stuart's suggestion is the best option here.

Regards,

Alex.

Former Member
0 Kudos

Thanks Alex,

I am using the scripts to make a next step decision, I want to display a message to the user that explains why the product was being routed off the standard flow.

Kev 🐵

0 Kudos

If your running 6.0 this should work and uses supported APIs...

importClass(java.lang.StringBuffer);

importPackage(Packages.com.sap.me.wpmf);

importClass(Packages.com.sap.me.wpmf.util.MessageHandler);

msgBuff=new StringBuffer();

msgBuff.append("Hello World");

MessageHandler.handle(msgBuff,null,MessageType.SUCCESS);

exit(true);

Cheers

0 Kudos

After re-reading your post, I realized that your running 4.2, not 6.0.....

The rhinoscript engine can compile javascript, so maybe you can try using some javascript instead.

I believe I had success with using the javascript "alert" function in 5.2 which might also work for 4.2.

So maybe try a script containing something like...

alert("This is a popup message to the operator");

Note: as Alexander said, scripts are really for next step decision, so maybe be aware of any unintended consequences from using javascript within the router script.