Custom Office - User Defined Scripts Help

SUGGESTED

I need help.

I created 2 numeric UDF's for CI_Item; PACK and EACH_COST.  I wanted to automatically calculate EACH_COST by taking the Item's Standard Cost and dividing it by the PACK.

I searched SageCity and found a simple script and modified it.  I am not a scripting expert, but I know enough to be dangerous. IT WORKED! (Script below)

But now, when I "X" out of a blank Item Maintenance screen, I get an ERROR 88.  I'm pretty sure it has to do with the Script interaction with the screen, but I don't know how to trap the error.

PLEASE HELP.

 

Error 88        Invalid/Unknown property name

O/S Error     Overflow

Program       SY_COMMONUI.PVC 

Statement    2105

Class           IM_item_ui

Method        CallScript

EACH_COST SCRIPT

StdUnitCost = 0
PACK = 0

retVal = oBusObj.GetValue("StandardUnitCost", StdUnitCost)
retVal = oBusObj.GetValue("UDF_PACK", PACK)

if (PACK) = isnull then retVal = oBusObj.SetValue("UDF_EACH_COST", 0) else if (PACK) = 0 then retVal = oBusObj.SetValue("UDF_EACH_COST", 0) else retVal = oBusObj.SetValue("UDF_EACH_COST", StdUnitCost/PACK)

Parents Reply
  • 0 in reply to Rod Roberts

    This type of script probably better plays to a business object event.  You are probably receiving errors because it is trying to fire off your script when you leave the screen, which means the business object (which you are using) no longer exists and has been dropped.

    You may want to put this script more on the "Pre-Write" event for the CI_Item_bus object, it all depends on whether you need this info displayed to the user prior to writing the record, etc.

    Elliott

Children