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 Children
  • 0 in reply to BigLouie

    I did notice that after my response and I was doing some testing on my system.  If the message is displaying in the Pre-Validate as an oScript.SetError then I am not sure why processing would continue.

    I am testing on Sage 100 2014 in ABC Demo Data Company using a new inventory item I set up as a standard cost item with a cost of $1000 and a Price of $0. In my testing, the behavior is as expected.  The warning message displays, the Quantity ordered is zero'd out and focus is set back to the Ordered column.

    Thanks,

    Kent

  • 0 in reply to Kent Mackall

    @ BigLouie,  @Kent Mackall and @W Jezewski.

    Thank you so much guys. I don't know why the warning won't pop up either. I have informed the client and they are settling for just the messagebox.

    I guess that's good enough for now. Thanks for your prompt responses and efforts.  

  • 0 in reply to tobitimac

    sometimes the .SetWarning() will not execute because of logic in Sage's validation that may turn off the warning.  Safest play here is to go with the message box that you are already implementing.

    E