Script not triggering message

SUGGESTED

Hi 

I wrote a simple script to trigger a message on the Sales Order Details Line when the Unit Cost is greater than the Unit Price but for some reasons, the message is not popping up. I set the event trigger to Post Column on QtyOrdered but when I enter the QtyOrdered on the line item, nothing pops up.

Any help? Here's my script.

if oSession.CompanyCode = "TTT" then 


Cost = 0
Price = 0

retVAL =oBusObj.GetValue("UnitCost",Cost)
retVAL =oBusObj.GetValue("UnitPrice",Price)

if Cost > Price then

retVal = oScript.SetError("WARNING: CANNOT USE THIS ITEM! The Item Cost is less than the Item Unit Price.")

end if

end if

Parents Reply
  • 0 in reply to BigLouie

    @ BigLouie - Yes, message box is showing the message but i'm trying to show a script error that will prevent the user from continuing.

    @Kent Mackall - I'm running the script in TTT. We want the message to trigger when a change is made on the Unit Cost on Sales order line item. Regardless of the item valuation, we are trying to prevent a sale when the cost is more than the unit price.

    @W Jezewski - I tried oScript.SetError on Pre-Validate event but that didn't work too. 

Children