Button Option on SO Invoice Entry for Batched Orders

SUGGESTED

I have two scripts running on the SO Invoice Date Entry Header, one on a pre-totals to change the "MultipleSalesOrdersApplied$" field to "N", this works no matter if there is more than one SO applied to the invoice.  My next script is a post read to change the "MultipleSalesOrdersApplied$" to "Y", however the way I have the script it is changing it to "Y" even if I only have one order applied to the invoice.  Could I put a button that ask the user if they want to change it back to "Y" (never did a button script).  Or could my script be adjusted somehow to only set the "MultipleSalesOrdersApplied$" field to "Y" if ....?

The SO's that need these scripts to fire never have a shiptocode and all start with the SO# "81".

'initialize variables pre-totals on shiptocode

retVal = 0
sShipTo = ""

retVal = oBusObj.GetValue("ShipToCode", sShipTo)

if sShipTo = "" then

	retVal = oBusObj.SetValueNoValidate("MultipleSalesOrdersApplied$", "N")
	
end if

'change read only field back to default value for multiple SO invoice

retVal = 0
nSOno = ""

retVal = oBusObj.GetValue("SalesOrderNo$", nSOno)

if Left(nSOno, 2) = "81" then

	retVal = oBusObj.SetValueNoValidate("MultipleSalesOrdersApplied$", "Y")
	
end if