presave

This example uses presave to check to see if a manufactured item exists for an approved formula; if one does not exist, the save operation is canceled.


Option Strict Off
imports System
imports System.Data
imports System.Diagnostics

Class HookScript
Inherits FcProcFuncSetEventHook
Function presave() As Long
Dim status As Long
Dim item As String
status = CLng(ObjProperty("STATUSIND"))
item = CStr(ObjProperty("ITEMCODE"))
if status > 100 and item = "" Then
 Dim lmsg as Long = MessageList("A Mfg Item is required. The save 
failed.")
 Return -1
 End If
Return 1
End Function
End Class