OnAddAttachment.LST script file

<< Click to Display Table of Contents >>

Navigation:  Programming Mechworks PDM > DBWCommandShell > Event Scripts > Database >

OnAddAttachment.LST script file

Description

This script is executed every time a new attachment is added to an existing document.

Activation

Options→General

Input

@DOCUMENT_UNIQUE_ID

the unique id of the existing DOCUMENT record you are adding an attachment to.

@DOCUMENT_PATHNAME

the full path name of the attachment
please note this line will be passed as many time as the number of documents selected in the open dialog

Output

@OKADD

0: stop adding
1: proceed with adding

Example

Avoid adding attachment if parent document is not in checked-out state

'x64

.VBSCRIPT
Sub Main()
 DBWInit(True)
 uid = DBWInput("@DOCUMENT_UNIQUE_ID")
 state = DBWQueryByUid(uid,DBWLookup("NAME_FIELD_STATE"))
 okAdd = 0
 If UCase(state) = UCase(DBWLookup("NAME_STATE_BEING_MODIFIED_STRING")) then
  okAdd = 1
 End If
 DBWOutput "@OKADD",okAdd,ForWriting
End Sub