- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Re: Script causes sales order to freeze
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-06-2012 10:37 PM
mandm, I would try commenting out all calls to MessageBox() to see if that helps determine the cause of the freezing. If that is the case, you might see some ProvideX processes that crashed on the server.
I've encountered the MessageBox freezing issue numerous times in 4.4 and had to disable them due to this problem. Along the way, I came up with a method that uses the standard VBScript function "MsgBox" for event scripts. It should also work for a button script that is executed on the server (in your case?). It's a rather crude solution to perform such a simple task, but I can organize it all up if you think it will help you. Hopefully, Elliott or someone else has an easy and more elegant solution.
Re: Script causes sales order to freeze
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-08-2012 07:52 PM
I currently use this for Sales Order Entry (Header) on a Table Post-Read event. I think it can be easily applied to a button script that is run on the server. So far, it seems completely stable and I have yet to see a ProvideX crash on the server.
1) Create a UDF that will store the text that you want to display to the user (e.g. UDF_MSGBOX_TEXT$) with a large enough length for the message. This will serve as a parameter to be sent from the event script.
2) Create a custom button on the main panel (DMAIN/DMAINW, not on a tab). Initially it can be visible, but on a live system, it should be hidden.
3) In the event script, you'll have your regular code and when you want to display a message box, set the value of UDF_MSGBOX_TEXT$ to the text you send to the user and invoke the custom button.
retVal = oBusObj.SetValue("UDF_MSGBOX_TEXT$", strMessage)
oScript.InvokeButton("BT_LINK_1")
4) Back in Customizer, Add UDF_MSGBOX_TEXT$ to the list of variables to be passed to the MS script for the custom button, which will execute the actual MsgBox function.
MsgBox SO_SalesOrder_bus_UDF_MSGBOX_TEXT, , "MAS 200 Custom Message"
Note that this would only work as an informational message box (OK) but not a decision one (Yes/No/Cancel). I think it's possible but it would be very tricky to continue working under the client side code in contrast to the normal BOI. Another drawback is that adding a UDF that is large in size will of course take up more space than most other smaller fields, unless there is a better way of passing a parameter to the client button script. Some other fine experts here may be able to revise and shorten this procedure.
HTH
Re: Script causes sales order to freeze
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-08-2012 08:02 PM
Nice. I did something similar along these lines to launch a button script from the business object side of things. I never thought to do what you did here, but I see this will work great. Thanks for the post!
Re: Script causes sales order to freeze
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-08-2012 08:04 PM
I wonder if a SetStorageVar, GetStorageVar would work here. This would avoid the need of a UDF as the value would only reside in memory while the program is running.
Re: Script causes sales order to freeze
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-08-2012 08:09 PM - last edited on 02-08-2012 08:11 PM
Glad to help, Gator! Yes, that is really the trick in order for this to work which I learned in another post some time ago.
EDIT: Oh, that is worth a shot. I'm not very familiar with those methods, but hopefully it might work and save space.
Re: Script causes sales order to freeze
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-09-2012 07:39 AM
roland, thanks for the work around, and gator using the SetStorageVar and GetStorageVar should work, if you use the ones from the oSession object.
retVal = oSession.SetStorageVar("messageText", "Message text")
then in the custom button script
retVal = oSession.GetStorageVar("messageText", msgTxt)
MsgBox msgTxt, "MAS 200 Custom Message"
I haven't tried this, but I think should work. Let us know!
Elliott
Re: Script causes sales order to freeze
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-09-2012 08:54 AM
Thanks Elliott! I'll try this out at the end of the day.
Just wondering, is the Session object still accessible if the custom button is set to execute the script on the client? I believe if I set the script to execute on the server, the MsgBox will appear on the server of course instead of the client's workstation.
Re: Script causes sales order to freeze
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-10-2012 05:36 AM
It appears that this did not work. Couple of things - I received the error below, then I noticed the Get & SetStorageVar should be called from oScript instead of oSession, but I still received the error for oScript, which makes sense since the script for GetStorageVar is executed in client's VBScript side instead of BOI or server side.
OLE Error Number : 424
Description : Object required: 'oSession'
Language : VBScript
Script Line : 27
Script Column : 0
Any other expert suggestions would be greatly appreciated.
Re: Script causes sales order to freeze
[ Edited ]- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-10-2012 07:00 AM - last edited on 02-10-2012 07:01 AM
What about creating a oSession level oScript object handle?
oSS_Script = 0
if Not(IsObject(oSS_Script)) then
Set oSS_Script = oSession.AsObject(oSession.ScriptObject)
end if
EDIT: When I get time, I'll try to test this too (won't be today).
Re: Script causes sales order to freeze
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-10-2012 09:14 AM
Thanks Gator, I'll test it on our live system later as well.


