Sage MAS 90 and 200 Sage MAS 500 blogs Product Feedback Support Training
Reply
Sage MAS 90 Customer
hyanaga
Posts: 34
Registered: 11-16-2010
0

Re: Error after using bSave in a VBScript

Very weird.  It goes through the Insert into tsoSOLine for all products, then it fails on the insert into tsoSOLineDist.  Can't figure out why, there's nothing actually written to the table yet because it's not saving line by line.  Checked the keys, it's using unique keys.  It doesn't already exist in the table, I don't understand why it's throwing that error. 

 

Hollie

Thanks!
Hollie
Sage MAS Partner
jmiles
Posts: 34
Registered: 12-04-2008
0

Re: Error after using bSave in a VBScript

I see that this thread is a few months old, and I don't know if it still an issue. Our experience has been that the sales order screen saves its data to the database as soon as a line item is added. Perhaps, instead of looping through the grid UI to check for certain line items, you could use the Session.AppDatabase object to query the tsoSalesOrder and tsoSOLine (and perhaps other) tables to verify the existence of the lines you want.

You'll need to determine the SOKey of the current sales order, which you should be able to get from the sales order number control, reference number control, and company ID (Session.CompanyID). Query the tsoSalesOrder table with that data to get the SOKey. Once you have the SOKey, you can query the tsoSOLine table for either the ItemKey or Description values you need.

Jason Miles
Technology Consultant
SGS Technology Group
http://www.sgstech.com
Moderator
JennyWilson
Posts: 78
Registered: 07-23-2009
0

Re: Error after using bSave in a VBScript

Just an FYI -- Sales Order only saves lines at the line level if you have the SO Option Commit Inventory at SO Line Entry checked.

Jenny Wilson
Principal Software Engineer
Sage 500 ERP
Sage MAS 90 Customer
hyanaga
Posts: 34
Registered: 11-16-2010
0

Re: Error after using bSave in a VBScript

Jenny is correct, and because we can't validate the items until all the lines are entered, we have that turned off.  If we have it turned on, the script on the Save event of the sales order runs after every line is entered.  We only want the script to run when the actual Save button is clicked.  I was thinking about creating my own "Save" button, so I can control when the script runs.

Thanks!
Hollie