Good morning - I've been fighting with different variations of this script and know that I'm missing something about the placement of the if-then-else but just can't see it. I have a button script to replace the current Accept button in Sales Order Entry to pop a message about terms/deposit details but allow the user past if needed. I can't get sales orders that don't meet these conditions to save and close - the order just stays open. The sales orders that do meet the condition will behave properly based on the user input. Any guidance would be appreciated!
retVal = oBusObj.GetValue("SalesOrderNo$", sSalesOrder)
retVal = oBusObj.GetValue("TermsCode$", sTermsCode)
retVal = oBusObj.GetValue("DepositAmt", nDepositAmt)
retVal = oBusObj.GetValue("PaymentType$", sPaymentType)
if (sTermsCode = "00" or sTermsCode = "99") and sPaymentType <> "CCWEB" and nDepositAmt = 0 then
sMsg = "PREPAID CUSTOMER ACCOUNT. EDIT PAYMENT INFORMATION?"
sMsgRetVal = oSession.AsObject(oSession.UI).MessageBox("",sMsg,"Style=YesNo")
if sMsgRetVal = "YES" then
retVal = oUIObj.InvokeChange("SalesOrderNo$", sSalesOrder)
retVal = oScript.InvokeButton("fldr.pTOTALS")
elseif sMsgRetVal = "NO" then
retVal = oUIObj.InvokeChange("SalesOrderNo$", sSalesOrder)
retVal = oUIObj.BT_Accept()
else
retVal = oUIObj.BT_Accept()
end if
end if
#scripting
------------------------------
Amber Prayfrock, Blytheco
------------------------------